Security Profile / Authentication Types , Uncheck WPA2 EAP

Certbot

user-pic
Vote 0 Votes

Certbot 已經成為 Let's Encrypt 的官方 Client
使用很簡單
cd /usr/local/bin
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
certbot-auto certonly --webroot -w /var/www/html -m yourname@email.com -d yourdomain.com -d www.yourdomain.com
若有更多域名, 繼續加 -d 參數指定
憑證會產生在 /etc/letsencrypt/live/

剩下不到30天內到期可以執行 Renew 指令
certbot-auto renew

Apache 設定
Uncomment Include conf/extra/httpd-ssl.conf in httpd.conf
conf/extra/httpd-ssl.conf 內容
SSLCertificateFile "/etc/letsencrypt/live/yourdomain.com/cert.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/yourdomain.com/privkey.pem"
SSLCertificateChainFile "/etc/letsencrypt/live/yourdomain.com/chain.pem"
SSLCACertificateFile "/etc/letsencrypt/live/yourdomain.com/fullchain.pem"

Add time stamps in bash history

user-pic
Vote 0 Votes

echo HISTTIMEFORMAT=\"%F %T \" >> /etc/profile

history
996 2017-12-14 12:49:18 ifconfig
997 2017-12-15 12:06:55 ifconfig
998 2017-12-15 12:49:08 ifconfig
999 2017-12-15 12:51:11 ifconfig
1000 2017-12-15 13:38:41 ifconfig

# curl -v https://google.com 2>&1 | egrep -i "issuer:|expire"
* expire date: Feb 01 00:11:00 2018 GMT
* issuer: CN=Google Internet Authority G2,O=Google Inc,C=US

Web to PDF/Image

user-pic
Vote 0 Votes

wkhtmltopdf is a command line web to PDF/Image tool.
wkhtmltopdf https://google.com output.pdf
wkhtmltoimage https://google.com output.png
Linux 版本中文有問題, Windows 版本中文正常, 輸出效果還不錯

HTML5 data-* attribute

user-pic
Vote 0 Votes

HTML5 data- 開頭是特殊屬性, data- 之後只能用小寫, 通常用來傳遞變數

例:
<button data-id='1234'>Click</botton>

jQuery 可以用 $(this).data("id")); 來取得 1234

fiddler HTTP/HTTPS Debugging Proxy using MITM
Chrome、IE、Opera test OK
Firefox need set proxy to 127.0.0.1:8888 manually

BASH regular expression

user-pic
Vote 0 Votes

e.g. Get http://mirror01.idc.hinet.net/CentOS/ first 7.x dir name

RE=">(7[0-9\.]+)"
[[ `curl -s http://mirror01.idc.hinet.net/CentOS/` =~ $RE ]]
echo ${BASH_REMATCH[1]}

Output:
7.0.1406

Screen reattach a session

user-pic
Vote 0 Votes

Useful when connection drop

screen -Dr
Reattach a session. If necessary detach and logout remotely first.

screen -DR
Attach here and now. In detail this means: If a session is running, then reattach.
If necessary detach and logout remotely first.
If it was not running create it and notify the user. This is the author's favorite.

curl -T to PUT file to PHP

user-pic
Vote 0 Votes

Sender
curl -T file http://host/upload.php

Receiver upload.php code
if ($_SERVER["REQUEST_METHOD"]=="PUT") file_put_contents(date("YmdHis") ,file_get_contents("php://input"));
// date("YmdHis") is output filename

Monthly Archives