Skip to content

Instantly share code, notes, and snippets.

View hanshasselberg's full-sized avatar

Hans Hasselberg hanshasselberg

View GitHub Profile
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).
{ 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+';
#!/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").
echo $1 >> temp.asm && nasm temp.asm -o temp.bin && rm temp.asm
od -N 16 -t x1 temp.bin && rm temp.bin
@hanshasselberg
hanshasselberg / gist:956950
Created May 5, 2011 12:26
set terminal/iterm tab title to current directory
chpwd () {
print -Pn "\e]0;%c\a"
}
@hanshasselberg
hanshasselberg / convert.md
Created January 19, 2012 10:45
Convert ruby 1.8 hash syntax to 1.9 with shell commands.

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:

@hanshasselberg
hanshasselberg / .vimrc
Last active September 30, 2015 22:07
Vim configuration
set nocompatible
filetype off
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
set nobackup
set nowritebackup
set noswapfile
set history=1000
set ruler
@hanshasselberg
hanshasselberg / gist:1885005
Created February 22, 2012 12:52
Some search/replace stuff for vim to clean up rspecs in mongoid.
# 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
@hanshasselberg
hanshasselberg / hack.sh
Created March 31, 2012 20:42 — forked from erikh/hack.sh
OSX For Hackers
#!/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
#
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"