Skip to content

Instantly share code, notes, and snippets.

@kungfoo
kungfoo / .xinitrc
Last active December 15, 2015 07:29
Wicked layout if you type a lot of german, english and happen to be programming quite a lot. I also swap Caps Lock for Control on keyboards that have this key.
setxkbmap us_wicked -option ctrl:nocaps -option lv3:ralt_switch
exec awesome
@kungfoo
kungfoo / gist:4706143
Created February 4, 2013 11:01
Hotot 0.9.8.10 PKGBUILD without KDE libraries
# Maintainer: speps <speps at aur dot archlinux dot org>
pkgbase=hotot
pkgname=hotot
true && pkgname=('hotot-data' 'hotot-gtk2' 'hotot-gtk3')
pkgver=0.9.8.10
pkgrel=2
pkgdesc="A lightweight & open source microblogging software (twitter identi.ca)."
arch=('any')
url="http://www.hotot.org/"
@kungfoo
kungfoo / gist:4705468
Created February 4, 2013 07:48
Sample fstab entry.
/dev/sdb2 / ext4 rw,relatime,noatime,data=ordered,discard 0 1
@kungfoo
kungfoo / gist:4705440
Created February 4, 2013 07:39
Set scheduler to deadline for SSD disks.
# Handle the scheduler choice according to the type of disk detected
# system default : set cfq scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"
# SSD specific : set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
#!/usr/bin/env ruby
status = `git status -sbz 2> /dev/null`
ahead = (status.match /ahead (\d+)/)
behind = (status.match /behind (\d+)/)
print "[" if ahead || behind
print "↑#{ahead[1]}" if ahead
print "↓#{behind[1]}" if behind
print "]" if ahead || behind
@kungfoo
kungfoo / 1.8.7-p358-with-rogue-stdout-patch
Created March 22, 2012 15:44
Installing 1.8.7-p358 with rbenv, when glibc >= 2.14 is installed
build_package_stdout_patch() {
wget 'http://bugs.ruby-lang.org/attachments/download/1931/stdout-rouge-fix.patch'
patch -p1 < stdout-rouge-fix.patch
}
require_gcc
install_package "ruby-1.8.7-p358" "http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz" stdout_patch standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz" ruby
@kungfoo
kungfoo / gist:964107
Last active September 25, 2015 18:18
Show git branch and dirty state on prompt
# Display the current git branch and wether its dirty
# https://gist.github.com/964107/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# username@Machine ~/dev/dir[master](1↑2↓)$ # clean working directory, but changes incoming and outgoing
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function git_ahead_behind {
@kungfoo
kungfoo / .bashrc
Last active September 25, 2015 02:48 — forked from henrik/.bashrc
Updated to new output with git 1.8.0.2
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@kungfoo
kungfoo / gist:703511
Created November 17, 2010 15:29
Objects.equal() and hashCode()
@Override
public int hashCode() {
return Objects.hashCode(describe(), markerType());
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
require File.join(File.dirname(__FILE__), "..", "spec_helper")
require File.join(File.dirname(__FILE__), "fake_document")
include Redcar
describe AutoIndenter::Analyzer do
scala = <<-SCALA
package ch.mollusca.stomp.frame