2018年11月9日
Javascript 強制轉換至https網址
if (location.protocol != 'https:'){
location.replace( 'https:' + window.location.href.substring(window.location.protocol.length) );
}
2018年11月1日
Grocery_crud CKEditor 客製化功能選單
Grocerycrud CKEditor客製化功能選單,留下常用的功能選單
/assets/grocery_crud/js/jquery_plusins/config/jquery.ckeditor.config.js
$(function(){
$( 'textarea.texteditor' ).ckeditor({toolbar:'MyBasic'});
$( 'textarea.mini-texteditor' ).ckeditor({toolbar:'MyBasic',width:700});
});
/assets/grocery_crud/texteditor/config.js
CKEDITOR.editorConfig = function( config )
{
CKEDITOR.config.toolbar_MyBasic =
[
[ 'Source','ShowBlocks','Maximize','Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat'],
'/',
['Image','Table','HorizontalRule','Link','Unlink','Anchor'],
'/',
['Styles','Format','Font','FontSize','TextColor','BGColor' ]
];
};
2018年9月20日
css ellipsis 當字數過多時,顯示...
當字數過多時,顯示...
.ellipsis {
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ellipsis {
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
2017年12月29日
PHP CURL 設定筆記
PHP CURL 設定筆記
GET
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://somewhere/?var=val");
//curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//不直接輸出
$result = curl_exec($ch);
curl_close($ch);
POST
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://somewhere/");
curl_setopt($ch, CURL_POST, true);
curl_setopt($ch, CURL_POSTFIELDS, http_build_query( array() ) );
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//不直接輸出
$result = curl_exec($ch);
curl_close($ch);
GET
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://somewhere/?var=val");
//curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//不直接輸出
$result = curl_exec($ch);
curl_close($ch);
POST
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://somewhere/");
curl_setopt($ch, CURL_POST, true);
curl_setopt($ch, CURL_POSTFIELDS, http_build_query( array() ) );
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//不直接輸出
$result = curl_exec($ch);
curl_close($ch);
2017年10月5日
Debian Fail2Ban 安裝設定筆記
安裝
apt-get install fail2ban
設定檔
/etc/fail2ban/fail2ban.conf
check
logtarget = /var/log/fail2ban.log
cp jail.conf jail.local
修改jail.local內容就好, 原始檔不動
jail.local設定會覆蓋jail.conf
注意事項
ignoreip = 127.0.0.1/8 192.168.1.0/24 (空白區隔)
bantime = 600(秒)
maxretry = 10 (失敗幾次封鎖)
增加dovecot
[dovecot]
enabled = true
port = pop3,pop3s,imap,imaps
filter = dovecot
logpath = /var/log/dovecot (看實際 log檔放哪)
maxretry = 10
/etc/fail2ban/filter.d/dovecot.conf
[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed).*rip=(?P\S*),.*
ignoreregex =
apt-get install fail2ban
設定檔
/etc/fail2ban/fail2ban.conf
check
logtarget = /var/log/fail2ban.log
cp jail.conf jail.local
修改jail.local內容就好, 原始檔不動
jail.local設定會覆蓋jail.conf
注意事項
ignoreip = 127.0.0.1/8 192.168.1.0/24 (空白區隔)
bantime = 600(秒)
maxretry = 10 (失敗幾次封鎖)
增加dovecot
[dovecot]
enabled = true
port = pop3,pop3s,imap,imaps
filter = dovecot
logpath = /var/log/dovecot (看實際 log檔放哪)
maxretry = 10
/etc/fail2ban/filter.d/dovecot.conf
[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed).*rip=(?P
ignoreregex =
/etc/fail2ban/filter.d/sasl.conf
failregex = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [A-Za-z0-9+/ ]*={0,2})?$
=========
測規則
Example1
fail2ban-regex /var/log/dovecot /etc/fail2ban/filter.d/dovecot.conf
Example2
fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/postfix.conf
Example3
fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/sasl.conf
2017年9月4日
Git stash指令記錄
儲存stash(僅追蹤中已修改)
git stash
儲存stash(包含未追蹤)
git stash -u
顯示已存的stash
git stash list
讀取stash
git stash apply
讀取stash (指定stash)
git stash apply stash@{1}
取出stash(原本stash會刪除)
git stash pop
刪除stash
git stash drop
刪除stash (指定stash)
git stash drop stash@{1}
清除stash
git stash clear
訂閱:
文章 (Atom)