Skip to content

Instantly share code, notes, and snippets.

View terrywang's full-sized avatar

Terry Wang terrywang

View GitHub Profile
#curl -L https://gist.github.com/karlentwistle/5029263/raw/84faa6a15a9c521533e33135090c1214c457f08d/chef_solo_bootstrap.sh | bash
aptitude -y update
echo "Installing RVM and Ruby dependencies"
sudo apt-get install -y build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion git-core libgdbm-dev pkg-config libffi-dev
echo "Installing RVM system-wide"
bash -c "bash <( curl -L https://github.com/wayneeseguin/rvm/raw/1.3.0/contrib/install-system-wide ) --version '1.3.0'"
cat >> /etc/profile <<'EOF'
# Load RVM if it is installed,
# first try to load user install
@smoser
smoser / gist:4756561
Last active November 8, 2023 15:20
boot a cloud image in kvm
## Install a necessary packages
$ sudo apt-get install kvm cloud-utils genisoimage
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
$ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
## download the image
$ wget $img_url -O disk.img.dist
## Create a file with some user-data in it
@chrismeller
chrismeller / ping.conf
Created February 9, 2013 20:02
My PHP-FPM pool.d config files.
[www]
ping.path = /ping
@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

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?

@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"
@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 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
@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