Skip to content

Instantly share code, notes, and snippets.

Joakim Bergman bergman

Block or report user

Report or block bergman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
public static class Result<T> implements Future<T> {
private Future<T> future;
private Result(Future<T> future) {
this.future = future;
* Block until done and {@code System.exit()} with an appropriate status code.
bergman /
Created Feb 14, 2017
some useful kubectl customisations
# run like this:
# kubectl get nodes -o json | python
import json
import sys
format = "%-45s %-12s %6s"
print format % ("NAME", "IP", "IMAGES")
bergman /
Created Aug 5, 2015
region code to region name
# curl -O ""
import csv
region_lookup = {}
with open("region_codes.csv", "rb") as f:
reader = csv.reader(f, delimiter=",")
for i, row in enumerate(reader):
region_lookup[(row[0], row[1])] = row[2]
bergman / ssh-rc
Created Oct 6, 2014
tmux ssh-agent forwarding
View ssh-rc
# this file goes in ~/.ssh/rc
if [ -S "$SSH_AUTH_SOCK" ]; then
# This gets executed by sshd on every client login, symlinking the forwarded
# agent socket into a predictable location to be picked up by tmux.
ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh_auth_sock"
bergman / gist:2407394
Created Apr 17, 2012 — forked from georgel/gist:2199359
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion
View gist:2407394

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7


bergman / largetype.zsh
Created Oct 26, 2011
Use Quicksilver}’s ’Large type’ command from zsh
View largetype.zsh
largetype() { osascript 2>/dev/null <<EOF
tell application "Quicksilver"
show large type "$*"
end tell
bergman /
Created Aug 19, 2010
A quick example of how to set up events for a video element that is already in the DOM and thus not created from within GWT.
package MyVideoPlayer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
bergman / gist:518984
Created Aug 11, 2010
Manual binding of events for html5 video in GWT
View gist:518984
class MyVideoPlayer {
private void onPlay() {
// do something
private native void bindEvents() /*-{
var instance = this;
var v = this.@MyVideoPlayer::getVideoElement()();
v.addEventListener("click", function() { instance.@MyVideoPlayer::onClick()(); });
v.addEventListener("touchstart", function() { instance.@MyVideoPlayer::onClick()(); });
View TimeMachine i ubuntu
Köra Time Machine i Ubuntu
echo deb sid main >> /etc/apt/sources.list
apt-key adv --keyserver --recv-keys 9AA38DCD55BE302B
aptitude install libgcrypt
aptitude install netatalk
View mp3 streaming in mpd
# install some package maintenance scripts (needed to build the .deb)
sudo aptitude install devscripts pbuilder
# get the source
apt-get source mpd
cd mpd-0.15.4
# change DEB_CONFIGURE_USER_FLAGS to include --enable-lame-encoder
vim debian/rules
# build dependencies
sudo /usr/lib/pbuilder/pbuilder-satisfydepends
# lame isn't a listed dependency so install it manually
You can’t perform that action at this time.