Skip to content

Instantly share code, notes, and snippets.

View yaodong's full-sized avatar

Yaodong Zhao yaodong

View GitHub Profile
@yaodong
yaodong / Karabiner Settings
Last active August 29, 2015 14:18
Karabiner Settings
#!/bin/sh
cli=/Applications/Karabiner.app/Contents/Library/bin/karabiner
$cli set option.emacsmode_controlD 1
/bin/echo -n .
$cli set option.emacsmode_controlV 1
/bin/echo -n .
$cli set option.emacsmode_optionV 1
/bin/echo -n .
@yaodong
yaodong / gist:d41bf018e03fbba3e913
Created April 2, 2015 16:07
focus on page from address bar
on alfred_script(q)
tell application "Google Chrome"
set theURL to "javascript:"
set URL of active tab of window 1 to theURL
end tell
end alfred_script
@yaodong
yaodong / git-replace-email.sh
Created January 10, 2015 16:16
replace email in git history
#!/usr/bin/env bash
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ];
then
GIT_COMMITTER_NAME="YOUR NAME";
GIT_AUTHOR_NAME="YOUR NAME";
GIT_COMMITTER_EMAIL="[email protected]";
GIT_AUTHOR_EMAIL="[email protected]";
git commit-tree "$@";
@yaodong
yaodong / todo.sh
Created January 10, 2015 16:16
push todo from terminal to omnifocus
#! /usr/bin/osascript
on run arguments
if (count of arguments) > 0 then
tell application "OmniFocus"
tell default document
set result to make new inbox task with properties {name:arguments}
end tell
end tell
display notification "[+] " & arguments
@yaodong
yaodong / dropbox-control.sh
Created January 10, 2015 16:15
script for start, stop and restart dropbox
#!/usr/bin/env bash
case $1 in
start)
open -a dropbox;
;;
stop)
osascript -e 'tell application "dropbox" to quit'
;;
restart)
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP.
#port=5353
PREFIX="/usr/local"
RBENV_PREFIX="$PREFIX/rbenv"
BIN_PATH="$PREFIX/bin"
RBENV_GROUP="rbenv"
umask 002
## Install rbenv, ruby-build and rbenv-gem-rehash
git clone git://github.com/sstephenson/rbenv.git $RBENV_PREFIX
@yaodong
yaodong / nginx.conf
Created August 28, 2014 11:42
Unicorn config examples
# This is example contains the bare mininum to get nginx going with
# Unicorn or Rainbows! servers. Generally these configuration settings
# are applicable to other HTTP application servers (and not just Ruby
# ones), so if you have one working well for proxying another app
# server, feel free to continue using it.
#
# The only setting we feel strongly about is the fail_timeout=0
# directive in the "upstream" block. max_fails=0 also has the same
# effect as fail_timeout=0 for current versions of nginx and may be
# used in its place.
FROM ubuntu:14.04
MAINTAINER Yaodong Zhao
RUN apt-get install -y build-essential libssl-dev git nginx postgresql postgresql-contrib
RUN git clone https://github.com/sstephenson/rbenv.git .rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ENV PATH ~/.rbenv/bin:~/.rbenv/bin:$PATH
@yaodong
yaodong / Berksfile
Created August 26, 2014 07:50
chef cookbooks
source "https://api.berkshelf.com"
cookbook 'build-essential', '~> 2.0.6'
cookbook 'sudo', '~> 2.7.0'
cookbook 'users', '~> 1.7.0'
cookbook 'chef-solo-search', '~> 0.5.1'
cookbook 'sshd', '~> 1.1.0'
cookbook 'fail2ban', '~> 2.2.0'
cookbook 'ufw', '~> 0.7.4'