Skip to content

Instantly share code, notes, and snippets.

View pahud's full-sized avatar
🏠
Working from home

Pahud Hsieh pahud

🏠
Working from home
View GitHub Profile
@pahud
pahud / daocloud.sh
Created April 16, 2015 05:54
daocloud for Ubuntu
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://49f8ef35.m.daocloud.io\"" | sudo tee -a /etc/default/docker
sudo service docker restart
@pahud
pahud / sysctl.conf.md
Created April 23, 2015 07:47
sysctl.conf tweaks
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024    65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
@pahud
pahud / cht_roaming.md
Last active August 29, 2015 14:19
中華電信國際漫遊

中華電信國際漫遊申請方式

##在國內

  • 手機撥打免付費「*135#」於互動式選單申請
  • 下載中華電信客服APP進行申請
  • 已持有中華電信月租型門號之客戶,可直接登入emome網站申請服務
  • 手機直撥800或市話撥0800-080-090 免付費客服專線洽詢
  • 至中華電信全區直營服務中心(不含特約服務中心)申請

##在國外

@pahud
pahud / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pahud
pahud / hmac_md5.lua
Created April 27, 2015 05:46
hmac_md5 by lua-resty-hmac
-- check https://github.com/jkeys089/lua-resty-hmac
local hmac = require "resty.hmac"
local hmac_md5 = hmac:new("secret_key", hmac.ALGOS.MD5)
local ok = hmac_md5:update("1234")
local mac = hmac_md5:final()
local str = require "resty.string"
ngx.say("hmac_md5: ", str.to_hex(mac))

enable keepalive to upstream you need to add the following lines

proxy_http_version 1.1; 
proxy_set_header Connection "";
@pahud
pahud / ntpdate_on_aws
Last active August 29, 2015 14:20
run ntpdate on AWS as cron
11 0,12 * * * root /usr/sbin/ntpdate $(( $RANDOM % 4 )).amazon.pool.ntp.org > /dev/null && /sbin/hwclock -w
@pahud
pahud / run_docker_aliyun.sh
Created May 11, 2015 07:59
run docker on aliyun
route del -net 172.16.0.0 netmask 255.240.0.0 dev eth0
@pahud
pahud / centos_32bit_comp_lib
Last active August 29, 2015 14:20
install centos 32bit compatible libraries
yum reinstall glibc.i686 glibc-devel.i686 compat-libstdc++-33.i686
@pahud
pahud / ubuntu_install_docker.sh
Last active August 29, 2015 14:22
install docker on ubuntu trusty
#!/bin/bash
#
apt-get update && apt-get install -y wget
apt-get install -y linux-image-generic-lts-trusty
wget -qO- https://get.docker.com/ | sh