Skip to content

Instantly share code, notes, and snippets.

View tsnow's full-sized avatar

Tim Snowhite tsnow

  • Palantir
  • Washington, DC
View GitHub Profile
#!/bin/bash
# USAGE: ./all_shortlogs.sh ~/dev
STARTDIR=`pwd`;
cd $1;
ls | while read i; do # For each repo name in the given directory
cd $1/$i;
echo $i; # Print the repo name
git shortlog -sn origin/master 2>/dev/null | # ignore repos which have no origin/master branch
head -n 5; # output the top 5 names from the shortlog.
done;
@tsnow
tsnow / gophercon-wifi.sh
Last active August 29, 2015 14:00
Connecting to the gophercon wifi
#!/bin/bash
for i in {1..100}; do
curl www.google.com 2>/dev/null 1>/dev/null && break ||
sudo ifconfig en0 down &&
sleep 1 &&
sudo ifconfig en0 up &&
sleep 4;
done
@tsnow
tsnow / README.md
Last active August 29, 2015 14:00
Go chat server

Installation

go run server.go

Usage

@tsnow
tsnow / manifest.html.sh
Last active August 29, 2015 14:00
manifest.html upload with s3-bash
#!/bin/bash
export bucket_name=pim-assets-production;
export AWS_ACCESS_KEY_ID=AKIAIPA6HVGVFP72TIQA;
echo -n "x-amz-acl: public-read" > ./aclheader;
ls ./s3.secret ~/Downloads/manifest.html #./s3.secret ~/Downloads/manifest.html
# The 0.02 version from google code does not properly parse the aclheader files.
./s3-put -v -c text/html -k $AWS_ACCESS_KEY_ID -a ./aclheader -s ./s3.secret -T ~/Downloads/manifest.html /$bucket_name/scratch/tim/manifest.html
@tsnow
tsnow / console.sh
Last active August 29, 2015 14:01
Simple Git Rebase example
## tsnow: double comments added for clarity.
## Pull down the most recent changes to the repository.
~/dev/pim$ git fetch origin
remote: Counting objects: 120, done.
remote: Compressing objects: 100% (117/117), done.
remote: Total 120 (delta 20), reused 29 (delta 1)
Receiving objects: 100% (120/120), 302.27 KiB | 0 bytes/s, done.
Resolving deltas: 100% (20/20), done.
From github.com:ridecharge/pim
@tsnow
tsnow / github_commits.sh
Last active August 29, 2015 14:01
All your commit messages on github
gem install github_api; ruby -rgithub_api -e 'g=Github.new(:basic_auth => %(USERNAME:PASSWORD)); puts g.repos.list.map{|i| g.repos.commits.list(:repo => i.name, :author => %(USERNAME), :user => i.owner.login).map{|j| j.commit.message }}'
@tsnow
tsnow / 0_README.md
Last active August 29, 2015 14:01
History of golang channels

http://golang.org/src/pkg/runtime/chan.c#L868

hg clone https://code.google.com/p/go/;
cd go;
hg log --template "{rev} {date|isodate}\n" -f src/pkg/runtime/chan.goc | tail -r | \
   while read i d _ __; do hg log -r $i -p > $d-$i.diff; done
@tsnow
tsnow / Gemfile
Last active August 29, 2015 14:01
Tmux Top 20 Watched Github Repositories Pair Programming Session Interview Setup
source 'https://rubygems.org'
gem 'yajl-ruby'
# A
class Concrete
class << self
def my_method
end
end
end
#B
class Concrete