Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / AppDelegate.m
Created November 19, 2012 16:24
How to bind two NSTextField instances to one NSString member
@implementation AppDelegate
@synthesize window = _window;
@synthesize textField1 = m_textField1;
@synthesize textField2 = m_textField2;
@synthesize foo = m_foo;
- (id)init {
self = [super init];
if (self) {
[
{
"group": "Lecture Rooms",
"rooms": [
{
"slug": "saal1",
"schedulename": "Saal 1",
"thumb": "http://localhost/streaming-website/thumbs/s1.png",
"link": "http://localhost/streaming-website/saal1/",
"display": "Saal 1",
@johnjohndoe
johnjohndoe / download.rb
Created December 16, 2012 17:46 — forked from leecade/download.rb
Replace hard coded file name with environment variable.
#!/usr/bin/env ruby
# An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's
# HTTP implementation.
#
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2012-03-25 21:18:59 -0600
require 'net/http'
require 'net/https' if RUBY_VERSION < '1.9'
@johnjohndoe
johnjohndoe / shrinkpdf.sh
Last active December 10, 2015 00:49
Shell script to shrink the size of PDF using ghostscript.
#!/bin/sh
#
# Source: http://www.alfredklomp.com/programming/shrinkpdf/
gs -q -dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.3 \
-dPDFSETTINGS=/screen \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
@johnjohndoe
johnjohndoe / delicious2013.css
Last active December 11, 2015 07:38
Custom stylesheet to change the look of the delicious.com website after it has been relaunched in early 2013.
/*
delicious.com - Custom styles 2013
Author: Tobias Preuss
Version: 2013-01-18 20:40
License: Creative Commons Attribution (CC BY)
Userstyles: http://userstyles.org/styles/81715/delicious-com-custom-styles-2013
Stylish browser add-on
for Firefox: https://addons.mozilla.org/en-US/firefox/addon/stylish/
@johnjohndoe
johnjohndoe / VimColorTest.vim
Created January 21, 2013 23:30
VimColorTest script to test Vim for 256 colors support. Place the script into ~/.vim/plugin/ and run it via :VimColorTest.
" Source: http://emerg3nc3.wordpress.com/2012/07/28/full-256-color-support-for-vim-andor-xterm-on-ubuntu-12-04/
"
" Color test: Save this file, then enter ':so %'
" Then enter the following commands:
" :VimColorTest "(for console/terminal Vim)
function! VimColorTest(outfile, fgend, bgend)
let result = []
for fg in range(a:fgend)
for bg in range(a:bgend)
let kw = printf('%-7s', printf('c_%d_%d', fg, bg))
@johnjohndoe
johnjohndoe / postboxes_around.xml
Last active December 12, 2015 01:01
Query for Overpass Turbo to find post boxes around a certain location
<osm-script output="json">
<query type="node">
<around lat="52.516667" lon="13.383333" radius="600"/>
<has-kv k="amenity" v="post_box"/>
</query>
<osm-script/>
<print/>
@johnjohndoe
johnjohndoe / xnview.ini
Created February 26, 2013 00:24
Settings file for XnView MP for Windows. Stored in C:\Users\%USER%\AppData\Roaming\XnViewMP. Created with XnView MP v0.51 beta.
[Start]
geom=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\xff\xff\xff\xf8\0\0\0\x1e\0\0\0\xcf\0\0\0\xf4\0\0\0\0\0\0\0<\0\0\0\xc7\0\0\0\xec\0\0\0\0\0\0)
RecentFiles=
OpenWith=@Invalid()
OpenWithName=@Invalid()
PathBrowser=C:/
History=
startupType=1
customPath=
startInFull=true
@johnjohndoe
johnjohndoe / berliner-tiefbauaemter.csv
Last active December 14, 2015 20:59
Machine readable list of the Tiefbauämter of Berlin. Converted with http://www.freepdfconvert.com/pdf-excel to convert the PDF to XLS, Google Refine to export the content as JSON and some minor manual work. Go here https://gist.github.com/stefanw/5148169 for Froide Import Format.
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 1.
"Bezirksamt";"Tel.-Zentr.";"Apparat Einwahl +";"Fax Einwahl +";"Dienstgebäude";"Postadresse";"Tiefbau- und Landschaftsplanungsamt FB Tiefbau"
"Mitte (Wedding, Tiergarten)";"9018-0";22823;22783;"Karl-Marx-Allee 31, 10178 Berlin";"Mathilde-Jakob-Platz 1, 10551 Berlin";"strassen-gruenflaechenamt@ba-mitte.verwalt-berlin.de"
"Friedrichshain-Kreuzberg";"90298-0";8040;8015;"Hallisches Ufer 80, 10963 Berlin";"Frankfurter Allee 35/37, 10247 Berlin";"tiefgruen@ba-fk.berlin.de"
"Pankow (Weißensee, Prenzlauer Berg)";"90295-0";;8629;"Darßer Straße 203, 13088 Berlin";"Breite Straße 24 A -26, 13187 Berlin";"tiefbauamt@ba-pankow.verwalt-berlin.de"
"Charlottenburg-Wilmersdorf";"9029-0";14421;14425;"Fehrbelliner Platz 4, 10702 Berlin";"Otto-Suhr-Allee 100, 10585 Berlin";"Tiefbau@charlottenburg-wilmersdorf.de"
"Spandau";"90279-0";2721;2016;"Carl-Schurz-Straße 2/6, 13578 Berlin";"Carl-Schurz-Straße 2-6, 13597 Berlin";"Tiefbau@ba-spandau.berlin.de"
"Steglitz-Zehlendorf";"90299-0";5264;7967;"Hartmannsweilerweg 63, 14163 Berlin";"K
@johnjohndoe
johnjohndoe / ferry_terminals_railway_stations_within_200.sql
Last active December 15, 2015 10:07
Ferry terminals and railway stations within 200 #dbhackathon #bahnhofsquartett
CREATE OR REPLACE VIEW
ferry_terminals_railway_stations_within_200 AS
SELECT
ferry_terminals.name AS ft_name,
railway_stations.name AS rs_name
FROM
ferry_terminals, railway_stations
WHERE
ST_DISTANCE(
ST_TRANSFORM(ferry_terminals.the_geom, 3857),