Skip to content

Instantly share code, notes, and snippets.

View rafecolton's full-sized avatar
👨‍💻
Infrastructure @ Expensify

Rafe Colton rafecolton

👨‍💻
Infrastructure @ Expensify
View GitHub Profile
@rafecolton
rafecolton / Golang-binary-versioning.md
Last active July 27, 2017 11:15
Copypasta for easy versioning for your Go binaries

Golang Binary Versioning Trick

To use, place the code in version_trick.go in your project. Don't forget to change the namespace to match yours to the actual name of your package.

In addition to version_trick.go, there's a makefile-snippet, that includes the secret sauce for making this trick work. Be sure to change the package name there as well.

Enjoy!

P.S. Special thanks to @meatballhat by way of @syscomet for showing me this trick!

@rafecolton
rafecolton / installing_and_using_gvm.bash
Last active December 20, 2015 02:49
Local Go Development with GVM
##################
# to install gvm #
##################
# install gvm
bash < <(curl -s https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer) 2>/dev/null
# this should be done automatically, but we'll double check that it's there
! grep -q 'gvm' "$HOME/.bash_profile" && \
echo '[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' >> ~/.bash_profile
@rafecolton
rafecolton / ssh-agent-stuff.bash
Created September 10, 2013 00:15
Keeping your SSH agent around in different sessions.
# export your current socket
echo "export $(env | grep SSH_AUTH_SOCK | head -n 1)" > "$HOME/.ssh/agent.out"
# source that file in your .bash_profile
str='[[ -s "$HOME/.ssh/agent.out" ]] && source ~/.ssh/agent.out'
grep -q "$str" "$HOME/.bash_profile" || echo "$str" >> "$HOME/.bash_profile"
@rafecolton
rafecolton / .gitconfig
Last active December 22, 2015 22:19
git tidy - cleans up your remote and local branches
[alias]
tidy = "!git remote prune origin 2>/dev/null; echo \"$(git branch -vv | grep origin | tr '[]*?+' ' ')\" | egrep -v \"$(git branch -r | awk '{print $1}')\" | awk '{print $1}' | xargs git branch -d 2>/dev/null"
refresh = "!git checkout master && git fetch && git pull --rebase && git tidy"
t = "!git tidy"
r = "!git refresh"

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

diff --git a/common.mk b/common.mk
index eb89a2b..59cdfe4 100644
--- a/common.mk
+++ b/common.mk
@@ -630,7 +630,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
" Vim indent file
" Language: Yaml
" Author: Ian Young
" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml
if exists("b:did_indent")
finish
endif
"runtime! indent/ruby.vim
"unlet! b:did_indent
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
# Scan known hosts
ssh-keygen -f /etc/ssh/ssh_known_hosts -H -F github.com
@rafecolton
rafecolton / .vimrc
Created February 4, 2014 04:33
Show hidden files with NERDTree
let NERDTreeShowHidden=1
@rafecolton
rafecolton / install-redis-from-source.sh
Last active August 29, 2015 13:56
Install redis from source
#!/usr/bin/env bash
# to use, run the following command:
# bash <(curl -s https://gist.github.com/rafecolton/8982564/raw/7e1ddc069e57810c4f9ee5ca109244b0b5cc0270/install-redis.sh)
cd "$HOME"
curl -s -O http://download.redis.io/redis-stable.tar.gz
tar -xzf redis-stable.tar.gz
cd redis-stable
make