Skip to content

Instantly share code, notes, and snippets.

Avatar

Hans Hasselberg i0rek

View GitHub Profile
View gist:cda247e94d30bfe91cee
The initial observed cluster behavior:
1) Constant churn of nodes between Failed and Alive
2) Message bus saturated (~150 updates/sec)
3) Subset of cluster affected
4) Some nodes that are flapping don't exist! (Node dead, or agent down)
One immediate question is how the cluster remained in an unstable
state. We expect that the cluster should converge and return to
a quiet state after some time. However, there was a bug in the
low level SWIM implementation (memberlist library).
View otx language definition for textmate
{ scopeName = 'assembler.otx';
fileTypes = ( 'otx' );
foldingStartMarker = '/\*\*|\{\s*$';
foldingStopMarker = '\*\*/|^\s*\}';
patterns = (
{ name = 'keyword.control.untitled';
match = '\b(if|while|for|return)\b';
},
{ name = 'support.numeric.offset.local';
match = '^\s*\+\d+';
View tm format method call
#!/usr/bin/env ruby
def format_method text, line
line.match /^(\s*)/
spaces = $1
text.match /^(\s*)([\w\d\s\_]+)\s*\((.*)\)/
formatted = "#{$2}(\n#{spaces}\t"
formatted += $3.
gsub(" ", "").
gsub(",", ",\n#{spaces}\t").
View gist:864025
echo $1 >> temp.asm && nasm temp.asm -o temp.bin && rm temp.asm
od -N 16 -t x1 temp.bin && rm temp.bin
@i0rek
i0rek / gist:956950
Created May 5, 2011
set terminal/iterm tab title to current directory
View gist:956950
chpwd () {
print -Pn "\e]0;%c\a"
}
@i0rek
i0rek / convert.md
Created Jan 19, 2012
Convert ruby 1.8 hash syntax to 1.9 with shell commands.
View convert.md

Convert to new ruby 1.9 Hashsyntax:

Convert :symbol => value to label: value:

find lib spec -type f -exec sed -i '' -E 's/:([_a-z]+)(\ *)=>/\1:/g' {} \;

Convert "string" => value to label: value:

@i0rek
i0rek / .vimrc
Last active Sep 30, 2015
Vim configuration
View .vimrc
set nocompatible
filetype off
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
set nobackup
set nowritebackup
set noswapfile
set history=1000
set ruler
@i0rek
i0rek / gist:1885005
Created Feb 22, 2012
Some search/replace stuff for vim to clean up rspecs in mongoid.
View gist:1885005
# let (:klass) { Person }
# to
# let(:klass) do
# Person
# end
:%s/\(\s*\)let(:\(.*\)) {\s*\(.*\)\s*}/\1let(:\2) do\r\1 \3\r\1end/g
# before { do_something }
# to
# before do
@i0rek
i0rek / hack.sh
Created Mar 31, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
View result
require 'rubygems'
require 'typhoeus'
require 'json'
require 'date'
require 'ostruct'
apikey = "0187fce21254fce68e5858518443c207"
version_url = "https://rubygems.org/api/v1/versions"
gem_url = "https://rubygems.org/api/v1/gems"