Skip to content

Instantly share code, notes, and snippets.

Patrick Ng patrickng

Block or report user

Report or block patrickng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
# Was asked how I keep my zshrc config sync'd between my computers with Dropbox
# Add a new directory in your Dropbox (or use an existing one)
mkdir -p ~/Dropbox/ohmyzsh
# move existing file to Dropbox
mv ~/.zshrc ~/Dropbox/ohmyzsh/zshrc
# symlink file back to your local directory
ln -s ~/Dropbox/ohmyzsh/zshrc ~/.zshrc

Install zsh first

apt-get install zsh

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

curl -L | sh

and then you change your shell to zsh

View truecrypt_fix.bash
libs=( "/usr/local/lib/libmacfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i64.2.dylib" \
"/usr/local/lib/libmacfuse_i64.2.dylib" \
"/usr/local/lib/" \
"/usr/local/lib/" \
"/usr/local/lib/pkgconfig/osxfuse.pc" )
patrickng / gist:6119765
Last active Dec 20, 2015
Shell script for serving current directory
View gist:6119765
# Put in .bashrc, .zshrc, or .profile
function serve {
open "http://localhost:${port}/" && ruby -r webrick -e "s = => $port, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
View ko-persist.js
ko.extenders.persist = function (target, option) {
target.subscribe(function (newValue) {
window.localStorage.setItem(option, newValue);
return target;
//and use it like this:
var item = ko.observable().extend({persist:"storedItem"});
patrickng / config
Created Nov 21, 2013
Alternative SSH
View config
Port 443
View monit.conf
# This is an event.d (upstart) script to keep monit running.
# To install disable the old way of doing things:
# /etc/init.d/monit stop && update-rc.d -f monit remove
# then put this script here:
# /etc/init/monit.conf
# and reload upstart configuration:
You can’t perform that action at this time.