sudo 免密码

  1. 执行 sudo visudo
  2. 在最后一行添加: [username] ALL=(ALL) NOPASSWD:ALL

参考: How to run sudo command with no password

urxvt 无下划线显示问题

添加配置: URxvt.lineSpace: 1

参考: Arch Linux Forum

安装 Node.js

1
2
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Ubuntu 默认的 nodejs 版本太旧,建议按照以下资源安装最新版本:

Ubuntu 安装 Shadowsocks

1. 安装

1
pip install shadowsocks

2. 创建软链接

1
ln -s [sslocal] /usr/local/bin/sslocal

3. 配置文件

1
vi /etc/shadowsocks.json
1
2
3
4
5
6
7
8
{
"server":"127.0.0.1",
"server_port":80,
"local_port":1080,
"password":"",
"timeout":600,
"method":"aes-256-cfb"
}

4. 开机启动

1
vi /etc/rc.local

添加:

1
/usr/local/bin/sslocal -c /etc/shadowsocks.json -d start

参考:

删除 PostgreSQL 数据库

1
psql -U postgres -W -h 127.0.0.1 -c "drop database [dbname]"

参考: Drop PostgreSQL database through command line

Python 二维数组求和

1
2
3
my_list = [ [1,2,3,4],
[2,4,5,6] ]
col_totals = [ sum(x) for x in zip(*my_list) ]

参考: How do I sum the columns in 2D list

Python defaultdict 嵌套

1
defaultdict(lambda : defaultdict(int))

参考: Python defaultdict of defaultdict

Hotfix 和 Bugfix 的区别

参考: Difference between hotfix and bugfix

JavaScript 数组最大值/最小值

参考: Calculate the max/min value from an array