Skip to content

Instantly share code, notes, and snippets.

View jasonmoo's full-sized avatar

Jason Mooberry jasonmoo

View GitHub Profile
#!/bin/bash -x
# 1. Set a blazingly fast keyboard repeat rate.
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write NSGlobalDomain KeyRepeat -int 1
# 2. Disable opening and closing window animations.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# 3. Disable the animations for opening Quick Look windows.

Keybase proof

I hereby claim:

  • I am jasonmoo on github.
  • I am jasonmoo (https://keybase.io/jasonmoo) on keybase.
  • I have a public key whose fingerprint is 8F13 A4BE 24E8 666B 42EA AA72 4881 E1A0 4704 CD29

To claim this, I am signing this object:

@jasonmoo
jasonmoo / go_update.sh
Created October 31, 2014 16:41
update local go and toolchain for linux to any tag
#!/bin/bash
set -e
VERSION=${1:-release}
GOROOT=${GOROOT:-/usr/local/go}
if [ ! -d $GOROOT ]; then
hg clone https://code.google.com/p/go $GOROOT
fi
@jasonmoo
jasonmoo / full_toolchain.sh
Created October 31, 2014 16:14
full toolchain
#!/bin/bash
cd /usr/local/go && hg pull
for version in go1.1 go1.2 go1.3 tip
do
hg up --clean $version
pushd src
GOOS=darwin GOARCH=386 ./make.bash
GOOS=darwin GOARCH=amd64 ./make.bash
@jasonmoo
jasonmoo / .profile
Created October 29, 2014 14:49
autocomplete your ssh hosts for osx
function complete_host() { grep "^Host $2" ~/.ssh/config | grep -v \* | cut -d\ -f2; }
complete -o nospace -C complete_host ssh scp csshX
@jasonmoo
jasonmoo / gzip_handler_wrapper.go
Created July 28, 2014 00:02
A simple wrapper for http gzipped response
type (
GzipResponseWriter struct {
io.Writer
http.ResponseWriter
}
)
func (g GzipResponseWriter) Write(b []byte) (int, error) {
return g.Writer.Write(b)
}
// using goamz grab a region
region := ec2.New(aws.Auth{
AccessKey: "XXXXXXX",
SecretKey: "XXXXXXX",
}, Instance_Region)
// get a list of public dns names by the server’s class
servers := pd.GetPublicDNS(region, Instance_ClassName)
// build a pool of servers and specify the concurrency
users := make([]*User, 0)
err := db.FindAll(&users, "WHERE `id` < 10")
if err != nil {
return err
}
for _, user := range users {
fmt.Printf("%d: %s (%s)\n", user.Id, user.Name, user.Email)
}
type User struct {
_meta string `table:"user"`
Id int `column:"id"`
Name string `column:"name"`
Email string `column:"email"`
}
user := new(User)
err = db.Find(user, "WHERE email = ?", email)
if err != nil {
return err
}