Skip to content

Instantly share code, notes, and snippets.

View spraints's full-sized avatar
🦦

Matt Burke spraints

🦦
View GitHub Profile
def show(x, y)
puts "#{y} #{y.to_f / x.to_f}"
end
a, b = ARGV.map(&:to_i)
c = a + b
puts a
show a, b
show b, c
50.times do
@spraints
spraints / add_putty_host.bat
Created March 18, 2010 15:43
Creates registry entries for a saved putty session with a window 80x40 and the ssh agent forwarded.
@echo off
setlocal
set alias=%1
set host=%2
set user=%3
if "" == "%alias%" goto :help
if "" == "%host%" set host=%alias%
if "" == "%user%" set user=%USERNAME%
rem echo Host: %host%
rem echo User: %user%
package main
import (
"fmt"
)
func main() {
try(&Owner{})
try(&Owner{org: &Organization{"group"}})
try(&Owner{user: &User{"person"}})
source "https://rubygems.org"
gem "mochilo", :git => "https://github.com/spraints/mochilo", :ref => "custom-type-registry"
gem "benchmark-ips"
@spraints
spraints / gist:1648617
Created January 20, 2012 17:40
setting up a subscription with stripe

Subscriptions with stripe

Code examples use the stripe ruby gem. Most of the links are to stripe's documentation.

![stripe's object model][stripe_object_model_diagram]

Initial setup

To start, create some plans.

@spraints
spraints / go.command
Last active April 13, 2017 00:26
Stitch a folder of images into a movie
#!/bin/bash
root=$(cd $(dirname "$0"); pwd)
cd $root
exec ruby process.rb "$@"
@spraints
spraints / bench-init.rb
Created October 5, 2016 12:13
benchmark a few styles of constructors in ruby
# I wanted to see how fast different constructor styles were.
#
# Calculating -------------------------------------
# splat 73.970k i/100ms
# manual splat 77.512k i/100ms
# kwarg 23.687k i/100ms
# attr 77.930k i/100ms
# opts 34.173k i/100ms
# fetch 29.289k i/100ms
# -------------------------------------------------
@spraints
spraints / .gitignore
Last active August 20, 2016 22:40
farmersmarket.com helpers
.bundle

I wanted to connect from a docker container on a prod server to an SVN server on my laptop today. The steps were tricky, so here they are:

ssh tunnel

Exposing the local port to the prod server is pretty straightforward

laptop$ ssh -R 4204:127.0.0.1:4204 myserver

docker networking