Skip to content

Instantly share code, notes, and snippets.

@btoews
btoews / demo.go
Last active April 22, 2016 17:56
error demo
package main
import (
"crypto/sha256"
"fmt"
"hash"
)
type Signer struct {
hash.Hash
@btoews
btoews / assdf
Last active November 5, 2015 18:01
asdf
asdf=6776f5e4b2f6971e9950b587dd87a530e9ec7585
@btoews
btoews / github_keychain.sh
Created August 14, 2015 18:43
Store GitHub access token in keychain
#!/bin/bash
echo -n "GitHub username: "
read username
echo -n "GitHub personal access token: "
read token
echo "Storing GitHub access token in keychain."
security add-generic-password -s github_access_token -a $username -w $token
@btoews
btoews / fix.rb
Created August 10, 2015 18:29
Network fix
def say(message)
`say -v cello #{message}`
end
def dhcp_refresh
system 'ipconfig set en0 DHCP'
end
def can_ping_google?
system('ping -c1 -t1 8.8.8.8') || system('ping -c1 -t1 8.8.8.8')
@btoews
btoews / slate
Created October 16, 2014 10:00
Slate Config
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Push Bindings
bind right:ctrl;cmd push right bar-resize:screenSizeX/3
bind left:ctrl;cmd push left bar-resize:screenSizeX/3
@btoews
btoews / drinkup.geojson
Last active August 29, 2015 14:07
Drinkup
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@btoews
btoews / asdf
Created August 11, 2014 18:20
asdf
asdf
@btoews
btoews / rack_session.rb
Created June 4, 2014 13:45
Decode Rack/Rails sessions with unknown classes
require 'cgi'
require 'base64'
require 'pp'
require 'ostruct'
def unmarshal(raw)
begin
Marshal.load raw
rescue ArgumentError => e
klass = e.message.split(' ').last.sub(/:+$/, '')
@btoews
btoews / find_gems.rb
Created April 22, 2014 11:09
Parse Gemfiles for all repositories belonging to a GitHub organization
require 'octokit'
require 'parser/current'
Octokit.auto_paginate = true
Octokit.connection_options[:request] ||= {}
Octokit.connection_options[:request][:timeout] = 240
API = Octokit::Client.new :access_token => ENV['GITHUB_ACCESS_TOKEN']
def get_gems_for_org_repos(org)
notice "Finding repos in the '#{org}' org."
@btoews
btoews / twilio_data.json
Created April 15, 2014 12:36
Country codes and Twilio deliverability rates
{
"Afghanistan": {
"country_code": "+93",
"deliverability_rate": 77
},
"Albania": {
"country_code": "+355"
},
"Algeria": {
"country_code": "+213",