Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am torsten on github.
  • I am torsten (https://keybase.io/torsten) on keybase.
  • I have a public key whose fingerprint is E054 EF92 AC0F B3E7 9BA3 5F8A 6B9B FA0C CE67 02B9

To claim this, I am signing this object:

@torsten
torsten / aslr-test.c
Created March 25, 2009 15:55
Testing address space layout randomization on Leopard
/*
A small program to test address space layout randomization (ASLR) on Leopard,
by Torsten Becker <torsten.becker@gmail.com>, 2009.
The presentation from a Apple guy at
http://www.slideshare.net/guest4c923d/jordan-hubbard-talk-lisa-presentation
suggests to compile with -pie but it doesn't work for me, I get the same
output every time which means it's not random, check it yourself:
$ gcc -fPIC -Wl,-pie aslr-test.c && ./a.out
@torsten
torsten / not_nil.m
Created March 30, 2009 10:06
Prove: [release] doesn't set a variable to nil
// gcc not_nil.m -lObjC -framework Foundation && ./a.out
#include <stdio.h>
#include <stdarg.h>
#include <Cocoa/Cocoa.h>
@interface FooClass : NSObject
{
}
@torsten
torsten / glextensions.c
Created June 8, 2009 20:25
Prints all available OpenGL extensions
// gcc -g -framework OpenGL -framework GLUT glextensions.c -o glextensions
#include <stdio.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#endif
@torsten
torsten / navajo.rb
Last active September 3, 2015 17:45
Navajo, a stupid simple Apache replacement (kinda)
#!/usr/bin/env ruby
# Copyright 2009-2014 Torsten Becker
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
@torsten
torsten / detect_gdb.c
Created March 30, 2010 12:39
Detecting an attached gdb on Mac OS X
#include <sys/sysctl.h>
#include <unistd.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
int main()
{
int mib[4];
@torsten
torsten / untar.sh
Created October 24, 2010 11:39
.zshrc lines for a "untar" command which automagically unzips .gz and .bz2 tarballs
untar() {
ruby -e 'f=$*[0];exec"tar","#{f=~/gz$/?"z":(f=~/bz2?$/?"j":
(raise"Incompatible Archive File"))}vxf",f' -- "$@"
}
@torsten
torsten / fetch.sh
Created November 1, 2010 22:06
.zshrc lines for fetch/wget style downloading with curl and ruby
fetch() {
ruby -e 'u=$*[0];q=39.chr;exec %Q{curl #{q+u+q} > \
#{q+u.gsub(%r{^.+/},"")+q}}' -- "$1"
}
TARGET = "iphone-nano"
TEMPLATE = app
QT = core gui
CONFIG += warn_on
HEADERS = src/IPhoneFrameWidget.h src/MainWindow.h src/helpers.h src/apps/App.h src/apps/Menu.h src/apps/ClockApp.h src/apps/MusicApp.h src/apps/PhotoApp.h
SOURCES = src/main.cc src/IPhoneFrameWidget.cc src/MainWindow.cc src/helpers.cc src/apps/App.cc src/apps/Menu.cc src/apps/ClockApp.cc src/apps/MusicApp.cc src/apps/PhotoApp.cc
INCLUDEPATH += src
@torsten
torsten / google-ssl+links.user.js
Created December 29, 2010 00:57
Greasemonkey script, adds the missing links to Google Images, etc when using Google SSL Search.