Skip to content

Instantly share code, notes, and snippets.

@fancyoung
fancyoung / nginx
Created March 20, 2013 06:31
/etc/init.d/nginx demo(rails + passenger)
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /var/run/nginx.pid
@fancyoung
fancyoung / Linux.md
Last active October 9, 2015 17:38
Linux常用命令(已迁到blog)

Alt + . 插入上一个命令的最后一个参数

$ wc -l 统计行数,常配合其它命令使用

$ du -sh dirname 查看某目录大小

$ scp frompath username@xxx.xxx.xxx:/path/on/server

@fancyoung
fancyoung / IRC.md
Last active October 9, 2015 13:08
IRC使用

常用命令

更改密码 /msg NickServ SET PASSWORD <newpassword>

Emacs之ERC

M-x erc-select

@fancyoung
fancyoung / git-cheat-sheet.md
Last active November 25, 2015 10:22
Git & Hg 常见操作(已迁到blog)

git

对比stage的文件 $ git diff --cached

修改最后一次提交 $ git commit --amend

取消上一次的提交(未push前) $ git reset --soft HEAD^

@fancyoung
fancyoung / html.html
Created October 28, 2011 02:08
HTML template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HTML template</title>
<link href="http://blueprintcss.org/blueprint/screen.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript"></script>
@fancyoung
fancyoung / ToHaml
Created October 27, 2011 07:01
move all .erb file to .haml
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
`rm #{file}`
end
@fancyoung
fancyoung / .Xresources
Created October 10, 2011 03:13
config xterm in .Xresources(xterm配置,解决某些快捷键不能用,中文乱码,配色)。After config, run $ xrdb ~/.Xresources
xterm*metaSendsEscape: true
XTerm*fontMenu*fontdefault*Label: Default
XTerm*faceName: Bitstream Vera Sans Mono Roman
XTerm*faceNameDoublesize: WenQuanYi Bitmap Song
XTerm*faceSize: 10
XTerm*cjkWidth: true
XTerm*mkWidth: true
XTerm*jumpScroll: true
XTerm*SaveLines: 10000
@fancyoung
fancyoung / .gitconfig
Last active September 26, 2015 08:38
git config file(~/.gitconfig) git配置文件
[core]
editor = vi
[user]
name = yourname
email = youremail@gmail.com
[alias]
co = checkout
st = status
br = branch
ci = commit
@fancyoung
fancyoung / rc.lua
Created May 11, 2011 08:17
config for awesome(~/.config/awesome/rc.lua)
autorun = true
autorunApps =
{
"google-chrome",
"LC_CTYPE=zh_CN.utf8 emacs",
"empathy",
terminal,
}
if autorun then
for app = 1, #autorunApps do
@fancyoung
fancyoung / .xinitrc
Created May 11, 2011 08:14
config for awesome(~/.xinitrc > ~/.Xsession: $ ln -s ~/.xinitrc ~/.xsession)
gnome-settings-daemon &
gnome-volume-manager &
gnome-power-manager &
nm-applet &
update-notifier &
mongod --dbpath /var/lib/mongodb/ &
exec awesome