git diff e630759 HEAD --name-only | xargs zip diff.zip
- 1月 03 週四 201911:54
[Git] 打包兩個 commit 之間的所有異動檔案
- 10月 05 週五 201810:42
[Gitbook] 放下載的連結
格式如下
<a href="xxx.zip" download target="_blank">xxx.zip</a>
<a href="xxx.zip" download target="_blank">xxx.zip</a>
- 4月 10 週二 201814:41
[Linux] 刪除目錄下,七天前的檔案
$ find . -type f -atime +7 | xargs rm
- 12月 28 週四 201714:13
[MySQL] 清除 query cache
雖然 query cache 可以提升效能,但如果在測試 API 效能的時候反而會造成困擾,可以用以下語法來清除 query cache
1. RESET QUERY CACHE;
2. FLUSH QUERY CACHE;
1. RESET QUERY CACHE;
2. FLUSH QUERY CACHE;
- 11月 28 週二 201710:23
[Linux] 搜尋目錄下有沒有未解的 git 衝突
方法1 (直接用 find 搜尋整個目錄)
$ find ./ -name \*.php -exec grep -wl '<<<<<<< HEAD' {} \;
方法2 (更新的時候,順便檢查兩個 commit 之間的異動)
$ git diff a57b997..ae47664 | grep '+<<<<<<< HEAD'
$ find ./ -name \*.php -exec grep -wl '<<<<<<< HEAD' {} \;
方法2 (更新的時候,順便檢查兩個 commit 之間的異動)
$ git diff a57b997..ae47664 | grep '+<<<<<<< HEAD'
- 11月 06 週一 201717:50
[PHP] Ubuntu 下使用 CodeIgniter 3 ,session 無法自動被刪除的問題
問題
這個問題是因為在 ubuntu 不知道哪一版開始,預設會把 php 刪除 session 的動作關掉
然後系統會自行使用 /usr/lib/php/sessionclear 的命令來清除 session
但預設刪除的是 sess_* 的檔案
但 CodeIgniter 3 產生的 session 檔案為 ci_session* 的檔案
所以 session 會一直留在目錄裡面,直到 目錄的 index 爆掉為止
筆記
session 預設目錄: /var/lib/php/sessions
session 刪除檔案的命令: /usr/lib/php/sessionclear
PHP 原生的 session 檔名: SESS_*
Codeigniter 3 建立的 session 檔名: ci_session*
這個問題是因為在 ubuntu 不知道哪一版開始,預設會把 php 刪除 session 的動作關掉
然後系統會自行使用 /usr/lib/php/sessionclear 的命令來清除 session
但預設刪除的是 sess_* 的檔案
但 CodeIgniter 3 產生的 session 檔案為 ci_session* 的檔案
所以 session 會一直留在目錄裡面,直到 目錄的 index 爆掉為止
筆記
session 預設目錄: /var/lib/php/sessions
session 刪除檔案的命令: /usr/lib/php/sessionclear
PHP 原生的 session 檔名: SESS_*
Codeigniter 3 建立的 session 檔名: ci_session*
- 10月 20 週五 201711:05
[Git] 找回被 reset 掉的 commit
1. 先使用 git reflog 查看剛才你還沒 push 的 commit 在哪
$ git reflog
b846b19 HEAD@{0}: reset: moving to origin/hotfix_#467_fix_email_reveal
ebe56b3 HEAD@{1}: checkout: moving from c50a74fa95aa586738946320a2d6bd013a4fb0e6 to ebe56b3c1cb256e2c07c34db9d5c6a3aff60240c
c50a74f HEAD@{2}: checkout: moving from hotfix_#467_fix_email_reveal to c50a74fa95aa586738946320a2d6bd013a4fb0e6
b846b19 HEAD@{3}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{4}: checkout: moving from hotfix_#467_fix_email_reveal to 9f13731
b846b19 HEAD@{5}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{6}: commit: 8787878787
4acb037 HEAD@{7}: checkout: moving from hotfix_#467_fix_email_reveal to 4acb037117557efe4b451fd3af4a7a3fad6a61d4
2. 再下 git checkout 到你消失的 commit (例 87878787)
$ git checkout 9f13731
Previous HEAD position was b846b19... [Feature] - #467 - hide commit message
HEAD is now at 9f13731... 8787878787
$ git reflog
b846b19 HEAD@{0}: reset: moving to origin/hotfix_#467_fix_email_reveal
ebe56b3 HEAD@{1}: checkout: moving from c50a74fa95aa586738946320a2d6bd013a4fb0e6 to ebe56b3c1cb256e2c07c34db9d5c6a3aff60240c
c50a74f HEAD@{2}: checkout: moving from hotfix_#467_fix_email_reveal to c50a74fa95aa586738946320a2d6bd013a4fb0e6
b846b19 HEAD@{3}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{4}: checkout: moving from hotfix_#467_fix_email_reveal to 9f13731
b846b19 HEAD@{5}: checkout: moving from 9f137318cee420484b7e1c3b70c16ab1debab782 to hotfix_#467_fix_email_reveal
9f13731 HEAD@{6}: commit: 8787878787
4acb037 HEAD@{7}: checkout: moving from hotfix_#467_fix_email_reveal to 4acb037117557efe4b451fd3af4a7a3fad6a61d4
2. 再下 git checkout 到你消失的 commit (例 87878787)
$ git checkout 9f13731
Previous HEAD position was b846b19... [Feature] - #467 - hide commit message
HEAD is now at 9f13731... 8787878787
- 10月 02 週一 201718:02
[PHP] 正規表示法拆成多行以及加註解的寫法
第一次看到,快速做個筆記。
function isMatch($url) {
$rx = '~
^([a-z]+) # 註解1
([0-9]+)$ # 註解2
~x';
return preg_match($rx, $url);
}
isMatch("111222333");
// false
isMatch("aaabbccc");
// false
isMatch("a1");
// true
isMatch("abc123");
// true
function isMatch($url) {
$rx = '~
^([a-z]+) # 註解1
([0-9]+)$ # 註解2
~x';
return preg_match($rx, $url);
}
isMatch("111222333");
// false
isMatch("aaabbccc");
// false
isMatch("a1");
// true
isMatch("abc123");
// true
- 9月 18 週一 201711:31
[MySQL] - 快速筆記
1. 顯示 schema
SHOW COLUMNS FROM `TABLE_NAME`;
SHOW COLUMNS FROM `TABLE_NAME`;
- 9月 11 週一 201718:30
[Mysql] mytop 監控
安裝
$ apt-get install
設定
$ vim ~/.mytop
$ apt-get install
設定
$ vim ~/.mytop
