Skip to content

Instantly share code, notes, and snippets.

View terrywang's full-sized avatar

Terry Wang terrywang

View GitHub Profile
@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"
@dcai
dcai / tmux.conf-2.x
Last active March 18, 2026 04:12
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
@mhayes
mhayes / flutes.txt
Created September 10, 2012 20:57
flute player
___
,'._,`.
(-.___.-)
(-.___.-)
`-.___.-'
(( @ @| . __
\ ` | ,\ |`. @| | | _.-._
__`.`=-=mm===mm:: | | |`. | | | ,'=` '=`.
( `-'|:/ /:/ `/ @| | | |, @| @| /---)W(---\
\ \ / / / / @| | ' (----| |----) ,~
@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

@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 = git@github.com: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:

@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;
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active September 10, 2026 02:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mhayes
mhayes / bootstrap.sh
Created June 6, 2012 15:44
Bootstrap RHEL6 box
#!/bin/bash
# bootstrap ruby on a fresh RHEL6.0
# Rackspace appears to mount /tmp as `noexec` which
# doesn't allow ruby-build to install ruby (since packages)
# downloaded can't be executed from /tmp so reassign
# the tmp directory
if [ ! -d "$HOME/tmp" ]; then
mkdir "$HOME/tmp"
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@hoffrocket
hoffrocket / ebsdiskhealth.py
Created May 23, 2012 05:03
raid0 ebs disk health monitor
#!/usr/bin/env python
import atexit
import datetime
from datetime import timedelta
import logging
import os
import smtplib
import subprocess as sub
import sys