Skip to content

Instantly share code, notes, and snippets.

@brianstorti
brianstorti / gist:9629116
Created March 18, 2014 20:42
keybase.md
### Keybase proof
I hereby claim:
* I am brianstorti on github.
* I am brianstorti (https://keybase.io/brianstorti) on keybase.
* I have a public key whose fingerprint is AC83 2A13 C81A FD98 4C06 4FF4 01CF 37BD BDBE 035C
To claim this, I am signing this object:
@brianstorti
brianstorti / gist:6137a1b65bde39562de8
Created July 16, 2014 19:23
Convert git diff to svn patch
git diff --ignore-space-at-eol --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" > patch.diff
@brianstorti
brianstorti / rack_middleware.rb
Last active August 29, 2015 14:08
Example rack middlewares
class Canadianize
def initialize(app, arg = "")
@app = app
@arg = arg
end
def call(env)
status, headers, content = @app.call(env)
content[0] += @arg + ", eh?"
[ status, headers, content ]
@brianstorti
brianstorti / client.rb
Created December 10, 2014 07:06
dumb client/server socket
require 'socket'
class Client
private
attr_reader :host, :port
public
def initialize(host, port)
@host, @port = host, port
end
@brianstorti
brianstorti / gist:8a2b96c65457905829bb
Last active August 29, 2015 14:12
rvm install error
Found old RVM 1.26.4 - updating.
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
Downloading https://github.com/wayneeseguin/rvm/archive/master.tar.gz
Upgrading the RVM installation in /Users/brianstorti/.rvm/
RVM PATH line found in /Users/brianstorti/.bashrc /Users/brianstorti/.zshrc.
RVM sourcing line found in /Users/brianstorti/.bash_profile /Users/brianstorti/.zlogin.
Upgrade of RVM in /Users/brianstorti/.rvm/ is complete.
Generated with:
rvm-restart
rvm get head
echo 1.26.4 >| $rvm_path/VERSION
rvm-restart
(
export PS4="+ %* %F{red}%x:%I %F{green}%N:%i%F{white} %_"
set -o xtrace
rvm --trace install 2.2.0 2>&1 | tee big.log
Java Virtual Machine statistics monitoring tool (jstat -options for all the options)
$ jstat -gcutil process_id 1000
S0 -> Survivors 0
S1 -> Survivors 1
E -> Eden
O -> Old
P -> Perm
YGC -> Young GC
@brianstorti
brianstorti / basic_mixin.rb
Created April 27, 2011 03:08
Basic mixin example
module Debug
def who_am_i?
self.class.name
end
end
class A
include Debug
end
@brianstorti
brianstorti / mixin_encapsulate.rb
Created April 27, 2011 03:33
Mixin to encapsulate functionality
module Summable
def sum
inject{ |i,j| i + j }
end
end
class Array
include Summable
end
@brianstorti
brianstorti / ubuntu_fix.txt
Created May 2, 2011 14:49
Ubuntu 11.04 ç
For those having trouble with 'ç' on Ubuntu 11.04:
Open gtk.immodules
$ sudo vim /usr/lib/gtk-2.0/2.10.0/gtk.immodules
Edit the following line:
"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"