Skip to content

Instantly share code, notes, and snippets.

View unhammer's full-sized avatar
kevin :: Coffee → Code

Kevin Brubeck Unhammer unhammer

kevin :: Coffee → Code
View GitHub Profile
@unhammer
unhammer / window-toggle-decorations.py
Created February 13, 2012 08:55
toggle gtk window decorations
#! /usr/bin/python2
import gtk.gdk
w = gtk.gdk.window_foreign_new( gtk.gdk.get_default_root_window().property_get("_NET_ACTIVE_WINDOW")[2][0] )
w.set_decorations( (w.get_decorations()+1)%2 ) # toggle between 0 and 1
gtk.gdk.window_process_all_updates()
gtk.gdk.flush()
# now bind this to super-r or something
(define (satsvis-standard fpattern)
(satsvis-lag-mw
fpattern
900 0 0
(list (list "/path/to/multiply.jpg" 'MULTIPLY-MODE 17)
(list "/path/to/overlay.jpg" 'OVERLAY-MODE 30))))
@unhammer
unhammer / to-utf.sh
Created April 20, 2012 10:30
turn an unholy jumble of iso-SOMETHING and UTF-8 into UTF-8
#!/bin/bash
decodehtmlentities='#!/usr/bin/env python2
import sys, codecs
sys.stdin = codecs.getreader("utf-8")(sys.stdin)
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
sys.stderr = codecs.getwriter("utf-8")(sys.stderr)
import HTMLParser
h = HTMLParser.HTMLParser()
@unhammer
unhammer / stdin.sh
Created May 29, 2012 20:39 — forked from anonymous/stdin.sh
fast-user-switch for kdm
#!/bin/bash
set -f # no globbing, so we can safely use *
# other_local[joe]=:0, other_local[bob]=:1 etc. for all active local
# users other than us:
unset other_local; declare -A other_local;
while read -rd $'\t'; do
IFS=$',\n' r=($REPLY)
[[ "${#r[@]}" -ge 4 && "${r[4]}" != '*' && "${r[2]}" != '' && "${r[0]}" != '' ]] && other_local[${r[2]}]=${r[0]}
@unhammer
unhammer / threading.py
Created June 11, 2012 17:54
simple backgrounding and waiting in python vs bash
#!/usr/bin/env python2
t1=Thread(target=myfunction, args=('MyStringHere',))
t2=Thread(target=myotherfunction, args=('MyOtherStringHere',1,10))
t1.start();t2.start();
t1.join();t2.join()
is equivalent to
#!/bin/bash
myfunction MyStringHere & P1=$!
@unhammer
unhammer / org-agenda-split.el
Created September 26, 2012 08:34
split-view agenda with life on top, then work
(setq org-agenda-custom-commands '(
;; …
("p" "Agenda with and without work stuff"
((agenda
""
((org-agenda-overriding-header "Life:")
(org-agenda-include-diary t)
(org-agenda-skip-function 'org-agenda-skip-work)))
(agenda
""
@unhammer
unhammer / README.md
Created October 1, 2012 13:29 — forked from mbostock/.block
pan on drag with d3

pan using zoom behaviour, unfortunately not very smooth

@unhammer
unhammer / README.md
Created October 5, 2012 08:19
cluster vs tree

cluster vs tree layout in d3

@unhammer
unhammer / popoutvideo.js
Last active December 14, 2015 07:08
maybe I just have to make a userstyle instead :/
// ==UserScript==
// @name Lesschrome popup of HTML5 video
// @description Lesschrome popup window of the current url; ensure you uncheck "Always show the tab bar" in Firefox tab settings
// @include *
// @version 1
// @grant none
// ==/UserScript==
function obj_to_settingsstr (obj) {
var settingsstr = "";
#!/bin/bash
step=10
# Workaround; analog-output-headphones never works, yet is switched to
# whenever I plug in headphones
pacmd set-sink-port 0 analog-output
vol=$(ponymix get-volume)