Skip to content

Instantly share code, notes, and snippets.

Torsten Becker torsten

Block or report user

Report or block torsten

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
torsten / .zshrc
Created Apr 2, 2012
zsh alias for GitHub's URL shortener
View .zshrc
# Based on
__make_git_io() {
curl -i -F "url=$1"
torsten /
Created Apr 1, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
torsten / property-access.m
Created Mar 27, 2012
Benchmark to measure how much slower property access is vs direct member access.
View property-access.m
// Compile as: clang -O4 -framework Foundation property-access.m && ./a.out
#import <Foundation/Foundation.h>
// Performance timer, credit: Lars Schneider @kit3bus
#import <mach/mach_time.h>
#define MAKE_NSSTRING(str) (NSString *)CFSTR(#str)
#define START(name) \
torsten / cheat.rb
Created Feb 3, 2012
cheat.rb: Self-contained script & database to remember and search for uncommon shell commands.
View cheat.rb
#!/usr/bin/env ruby
# Self-contained ruby script & database to remember uncommon shell commands
# and search for them using the command line.
# Originally written by Torsten Becker <> in 2012.
# Usage: cheat.rb [SEARCHTERM]
# If SEARCHTERM is given, cheat.rb lists only cheats that contain this term.
# Otherwise lists all cheats.
torsten / gist:1589419
Created Jan 10, 2012
"Detecting" IE version for CSS
View gist:1589419
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
torsten /
Created Dec 20, 2011
Wrapping OpenGL calls in error checks
#!/usr/bin/env python3
# Originally written by Torsten Becker <> in 2011
import re
gl_function = re.compile(r'^extern\s+(.+)\s+(\w+)\s*\((.+)\)\s*;\s*$')
argument = re.compile(r'(\w+)\s*$')
torsten /
Created Apr 21, 2011
Prints a list of all committers in a subversion repository, sorted by number of commits.
# Prints a list of all committers in a subversion repository,
# sorted by number of commits.
# Written by Torsten Becker <> in 2011
if [[ ! $1 ]]; then
echo "Usage: $0 SVN-REPO-URL"
exit 1
torsten /
Created Apr 1, 2011
Calculates z-ordered values from x and y coordinates.
def z_order(x, y):
"""Creates a z-order value from the 15 least significant bits of
the `int`s `x` and `y`.
z = 0
for bit_pos in range(15):
z |= (x & (1 << bit_pos)) << bit_pos
z |= (y & (1 << bit_pos)) << (bit_pos + 1)
torsten /
Created Feb 20, 2011
A port of Huy Nguyen's bash directory bookmarks to zsh
# Original code for bash from:
# Zsh Directory Bookmarks
alias m1='alias g1="cd `pwd`"'
alias m2='alias g2="cd `pwd`"'
alias m3='alias g3="cd `pwd`"'
alias m4='alias g4="cd `pwd`"'
alias m5='alias g5="cd `pwd`"'
alias m6='alias g6="cd `pwd`"'
torsten / chrome-dot-url-opener.user.js
Created Jan 31, 2011
Greasemonkey script, enables Google Chrome to handle .URL files.
View chrome-dot-url-opener.user.js
// ==UserScript==
// @name .URL file opener for Google Chrome
// @namespace
// @match file://*.URL
// @match file://*.url
// @author Torsten Becker
// @description Enables Chrome to handle .URL files (internet shortcuts, usually created on Windows) and navigates to their referenced location.
// ==/UserScript==
// Installation notes:
You can’t perform that action at this time.