發表文章

目前顯示的是 4月, 2016的文章

[ Ubuntu ] git pull/push 不用輸入密碼 / install imagemagick

首先在ubuntu把git安裝起來 >> apt-get install git 接著產生ubuntu的public key並輸出到github/bitbucket上 >>ssh-keygen -t rsa 然後就一直按Enter (不用輸入phrase) 產生的key (~/.ssh/id_rsa.pub) 可以用cat ~/.ssh/id_rsa.pub輸出到terminal上 並且複製,貼在bitbucket中 https://bitbucket.org/account/user/帳號/ssh-keys/ 之後做push/pull就都不用密碼囉! 如果是第一次在bitbucket建立repo 可先到自己的機器上設定好remote url git init git add . git remote set-url origin git@bitbucket.org:XXXXX/XXXXX.git git -c user.name='你的username' -c user.email='你的Email' commit -m "init" git push --set-upstream origin master ref: http://stackoverflow.com/questions/3311774/how-to-convert-existing-non-empty-directory-into-a-git-working-directory-and-pus 安裝imagemagick >> sudo apt-get install imagemagick

[ nginx ] 根據accept-language來重導網址

先安裝nginx-extras >> sudo apt-get install nginx-extras 編輯nginx設定檔 location = /public/privacy/ { rewrite_by_lua ' for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do if string.sub(lang, 0, 2) == "en" then ngx.redirect("/public/privacy/en/") end if string.sub(lang, 0, 2) == "zh" then ngx.redirect("/public/privacy/zh") end end ngx.redirect("/public/privacy/en/") '; } 重新啟動nginx即可 >> sudo service nginx restart Rederence :  http://www.cybrilla.com/blog/auto-redirect-based-on-language-in-nginx/