Skip to content

Instantly share code, notes, and snippets.

@chen206
chen206 / gist:4030441
Created November 7, 2012 09:45
Install Postgresql 9.2 on Ubuntu 12.04
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.
@chen206
chen206 / gist:4083275
Created November 16, 2012 02:05
python snippets
>>> t = ((1, 'a'),(2, 'b'))
>>> dict((y, x) for x, y in t)
{'a': 1, 'b': 2}
>>> [1] * 5
[1, 1, 1, 1, 1]
>>> ['%s'] * 5
['%s', '%s', '%s', '%s', '%s']
1. 编辑NERD_tree.vim,
2. 找到 call s:initVariable("g:NERDTreeDirArrows", !s:running_windows)
3. 把那个"!"去掉
Make sure that PuTTY is set for UTF-8 as well. You can do this under Window -> Translation -> Remote Character Set. You may need to choose a font that supports a reasonable portion of the Unicode range as well -- Terminal isn't necessarily going to cut it.
@chen206
chen206 / mac os x.md
Last active October 13, 2015 01:18
os x, maverick

~/Library/Application Support/SIMBL/Plugins/TerminalColours-SL-64bit.bundle/Contents/Info.plist

Change MaxBundleVersion

sudo killall -HUP mDNSResponder
@chen206
chen206 / tornado-server.md
Last active February 19, 2017 12:31
tornado server, ubuntu 12.04.2, mysql5.5, python2.7, tornado2.4.1, virtualenv, celery3.0.19, redis2.7.4, mongo

AptGet source.list

/etc/apt/source.list

deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise main restricted

deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted
@chen206
chen206 / git.md
Last active December 19, 2015 08:19
git, 分布式

git config

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

共享设置

添加一个用户账号:git:123456

将atweiquan工程的父级目录共享,比如D:\work\atweiquan,将work共享

@chen206
chen206 / s.html
Created July 5, 2013 03:26
html, css, js
<table style="table-layout: fixed; width: 100%">
<tr>
<td style="word-wrap: break-word">
LongLongLong...LongWord
</td>
</tr>
</table>
@chen206
chen206 / nginx-php5-fpm.md
Last active December 19, 2015 13:39
ubuntu 12.04.2, os x, nginx, php5-fpm, php5-cli, php5-mysql, phpmyadmin

Ubuntu

sudo apt-get install nginx -y
sudo apt-get install php5-fpm php5-cli php5-mysql -y
sudo apt-get install phpmyadmin -y

cd /etc/php5/cli
sudo mv php.ini php.ini.backup
sudo ln -s ../fpm/php.ini
@chen206
chen206 / google.md
Last active December 20, 2015 09:48
  1. 加号

在Google的输入框里,所有的空格都被Google理解为加号+。如果你输入的是purpose of education那么Google返回的文章里既有“purpose”存在,也有“education”存在,但不一定有“purpose of education”存在。另外,过分常用的、单独存在没有意义的词汇往往被忽略掉,比如冠词“a”、“the”;介词“of”、“in”、“on”、“at”、“to”;连词“and”、“or”、“but”;从属连词“that”、“which”、“when”;代词“my”、“his”、“them”等等。

  1. 双引号

把搜索词放在双引号中,代表完全匹配搜索,也就是说搜索结果返回的页面包含双引号中出现的所有的词,连顺序也必须完全匹配。bd和Google 都支持这个指令。例如搜索: "seo方法图片"

  1. 减号