Skip to content

Instantly share code, notes, and snippets.

View yawn's full-sized avatar
😷
3密

Joern Barthel yawn

😷
3密
  • Berlin
View GitHub Profile
unzip -o \*.jar -x META-INF/*; rm *.jar
@yawn
yawn / connection-quality.rb
Created February 23, 2011 11:52
To proxy or not to proxy, that's the question
class Connection
require 'net/http'
TEST_HOST = 'www.example.com'
TEST_PORT = 80
TEST_PATH = '/index.html'
# yields either one of the supplied proxy or :unrestricted (no proxy) or :restricted (nothing worked)
def self.quality? *proxies
class Foo
end
puts Foo.new
f = Foo.new
f.instance_eval do |e|
meta = class << e
@yawn
yawn / gist:1275110
Created October 10, 2011 11:42
FSM.java
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
java.lang.NegativeArraySizeException: null
org/jruby/util/ByteList.java:339:in `ensure'
org/jruby/RubyString.java:856:in `modify'
org/jruby/RubyString.java:1255:in `cat'
org/jruby/RubyString.java:1221:in `cat19'
org/jruby/RubyArray.java:1488:in `inspectAry'
org/jruby/RubyArray.java:1509:in `inspect'
org/jruby/RubyArray$i$0$0$inspect.gen:65535:in `call'
org/jruby/RubyClass.java:632:in `finvoke'
org/jruby/javasupport/util/RuntimeHelpers.java:545:in `invoke'
@yawn
yawn / yawn.zsh-theme
Created February 28, 2012 18:27
Fork of skwp.zsh-theme (using the pro terminal)
# Simple theme with RVM prompt
PROMPT='%{$fg[white]%}%~%{$fg[yellow]%}$(git_prompt_info)%{$reset_color%}%{$fg[white]%}: %{$reset_color%}'
RPROMPT='%{$fg[grey]%}$(rvm-prompt v p g)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" "
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY=" UF"
ZSH_THEME_GIT_PROMPT_CLEAN=" CL"
@yawn
yawn / init.pp
Created March 14, 2012 10:23
Enable sudo upstart for a deployment $user
augeas { "Allow upstart operations w/o password":
context => "/files/etc/sudoers",
changes => [
"set Cmnd_Alias[alias/name = \"UPSTART\"]/alias/name UPSTART",
"set Cmnd_Alias[alias/name = \"UPSTART\"]/alias/command[1] /sbin/start",
"set Cmnd_Alias[alias/name = \"UPSTART\"]/alias/command[2] /sbin/stop",
"set Cmnd_Alias[alias/name = \"UPSTART\"]/alias/command[3] /sbin/restart",
"set Cmnd_Alias[alias/name = \"UPSTART\"]/alias/command[4] /sbin/initctl",
"set spec[user = \"${user}\"]/user ${user}",
"set spec[user = \"${user}\"]/host_group/host ALL",
@yawn
yawn / tmux_cheatsheet.markdown
Created November 1, 2012 08:20 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@yawn
yawn / gist:5451974
Created April 24, 2013 13:04
Package libvmod-boltsort - needs to be called in the `VMODDIR` of the build environment
fpm -t rpm \
-s dir \
--prefix=/usr/lib64/varnish/vmods \
-n libvmod-boltsort \
-v 1.0.0 \
--iteration `git rev-parse --short HEAD` \
--epoch `date +"%s"` \
-a noarch \
--license 'Apache License 2.0' \
--vendor 'Vimeo, LLC' \
VARNISH_VERSION=3.0.3
VMOD_REPOSITORY=https://github.com/vimeo/libvmod-boltsort.git
VMOD_NAME=libvmod-boltsort
VMOD_VERSION='1.0.0'
VMOD_LICENSE='Apache License 2.0'
VMOD_VENDOR='Vimeo, LLC'
VMOD_DESCRIPTION='Sort query strings in Varnish'
sudo yum install -y pcre-devel python-docutils