Skip to content

Instantly share code, notes, and snippets.

View thbishop's full-sized avatar

Tommy Bishop thbishop

View GitHub Profile

Keybase proof

I hereby claim:

  • I am thbishop on github.
  • I am thbishop (https://keybase.io/thbishop) on keybase.
  • I have a public key whose fingerprint is D841 6C3B 44B7 0923 1DF7 0095 D75B 40F6 6B3A 1602

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am thbishop on github.
  • I am thbishop (https://keybase.io/thbishop) on keybase.
  • I have a public key whose fingerprint is 4B33 23A9 06E2 6539 5F1B EACC 5F08 05BA B96C B491

To claim this, I am signing this object:

(def headers->keywords (array-map "Name" :name, "Glitter Index" :glitter-index))
(defn csv-headers [] (s/join "," (keys headers->keywords)))
(defn data->csv
"Converts ({:name 'Foo' :glitter-index 10} to 'Foo,10')"
[data]
(clojure.string/join "\n" (cons csv-headers ["foo,bar"]))))
; this returns
; "fwpd.core$csv_headers@2bfe621e\nfoo,bar"
@thbishop
thbishop / main.go
Created October 30, 2014 21:26
basic golang manners impl
package main
import (
"fmt"
"github.com/braintree/manners"
"net/http"
"os"
"os/signal"
"syscall"
"time"
Kernel.exec "ssh #{ARGV[0]}"
[alias]
pr = "!open \"$(git remote -v | grep origin | grep push | cut -f 2 | cut -d \" \" -f 1 | sed -e \"s|git@\\(.*\\):\\(.*\\).git|https://\\1/\\2|\")/pull/new/$(git rev-parse --abbrev-ref HEAD)\""
o = Object.new
o.define_singleton_method 'node' do
{ 'a' => 1 }
end
o.node
@thbishop
thbishop / caller.rb
Created January 6, 2012 18:49
custom logger wrapping slogger gem
CustomLogger.info 'here is info'
CustomLogger.debug'here is debug'
CustomLogger.warn 'here is warn'
CustomLogger.error 'here is error'
# and this will record the execution time of the block and inject it into the message
CustomLogger.info 'here is a timing item. i wonder how long it will take' do
sleep 10
end
@thbishop
thbishop / delete_fusion_vm_from_plist.rb
Created July 31, 2011 22:23
How to programmatically delete a VM from VMware Fusion
# The primary fusion app must be closed for this to work.
# It appears that the primary fusion app holds the plist data in memory
# and will write the changes to disk when it closes
# (including overwriting any changes made by another app).
# You should not have any issues if you execute this when there are
# headless VMs running (i.e. 'vmrun start $path_to_vmx nogui').
require 'cfpropertylist'
plist_file_path = '/Users/tbishop/Library/Preferences/com.vmware.fusion.plist'
existing_plist = CFPropertyList::List.new(:file => plist_file_path)
@thbishop
thbishop / gem_upgrade.sh
Created May 6, 2011 18:11
Update rubygems to a specific version
gem install -v 1.3.6 rubygems-update && ruby `gem env gemdir`/gems/rubygems-update-1.3.6/setup.rb