Skip to content

Instantly share code, notes, and snippets.

View terrywang's full-sized avatar

Terry Wang terrywang

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 21, 2025 18:31
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@SaitoWu
SaitoWu / gollum.md
Created August 9, 2012 02:46
self host a gollum wiki.

nginx configuration:

user root admin;

worker_processes  1;

# pid of nginx master process
pid /var/run/nginx.pid;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@zealot128
zealot128 / README.md
Created August 13, 2012 21:15
Debian startup file for Rails thin instances

Rails startup with bundler, rvm and specific user

e.g. for user stefan, starting two different applications, located under /apps/APPLICATION/prod/current.

This script is very useful, because it is run at startup of server, so no 503 anymore.

Put this script under /etc/init.d/ and make it executable chmod +x /etc/init.d/rails_apps

@mhayes
mhayes / flutes.txt
Created September 10, 2012 20:57
flute player
___
,'._,`.
(-.___.-)
(-.___.-)
`-.___.-'
(( @ @| . __
\ ` | ,\ |`. @| | | _.-._
__`.`=-=mm===mm:: | | |`. | | | ,'=` '=`.
( `-'|:/ /:/ `/ @| | | |, @| @| /---)W(---\
\ \ / / / / @| | ' (----| |----) ,~
@dcai
dcai / tmux.conf-2.x
Last active May 6, 2025 07:57
tmux config
# Author: Dongsheng Cai
#
# Gist: https://gist.github.com/dcai/3824286
#
# c-d to close shell
# <prefix> s to switch to another session
# <prefix> f to find a window
# <prefix> o to switch to another panel
# <prefix> ! to close other panes except current one
# <prefix> x Kill the current pane
@dcai
dcai / .bashrc
Last active April 25, 2020 13:35
minimal .bashrc
#!/bin/bash
# https://gist.github.com/dcai/3847582/
[[ -r /etc/bash_completion ]] && source /etc/bash_completion
# TERM COLOR
export WHITE="\033[1;37m"
export YELLOW="\033[1;33m"
export GREEN="\033[1;32m"
@7hunderbird
7hunderbird / deploy.rb
Created October 22, 2012 21:14
Act 2
require "bundler/capistrano"
set :application, "awesome"
set :user, "vagrant"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "[email protected]:7hunderbird/#{application}.git"

Snow in canvas land

Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.

Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.

Ugh, I can't believe I just wrote "performance landscape". Anyway...

How does the demo work?

@ergatea
ergatea / gist:4487615
Created January 8, 2013 20:26
Shadowsocks 启动脚本
Shadowsocks 启动脚本
# insserv -v -d /etc/init.d/shadowsocks
=====================
#!/bin/sh
### BEGIN INIT INFO
# Provides: shadowsocks
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog