Category Archives: Articles in english

lua & timezones by name

A bit hard to puzzle due to scarce documentation. #!/usr/bin/env lua local luatz = require ‘luatz’ — https://github.com/daurnimator/luatz/   local tz_name = ‘Europe/Berlin’ local ts_loc = luatz.time({year=2014, month=12, day=31, hour=23, min=59})   — %z isn’t supported yet: https://github.com/daurnimator/luatz/blob/523b2e0f1ece77c569f6db4c040886ed3124512e/luatz/strftime.lua#L178 local function tz_off_iso8601(tz_offset_seconds) local separator = ” — 8601 %z compliant — separator = ‘:’ — 8601 […]

Why PHP is utterly broken

tl;dr: neither does DATE_RFC1123 produce a rfc1123-date, nor does DATE_RFC850 a rfc850-date. What sense does that make? This example may look scrupulous but seems typical. Mind the mandatory word ‘GMT‘ at the end of rfc1123-date. While DATE_RFC1123 renders something ending with +0000. Which is the same timezone but not the same string. So DATE_RFC1123 is useless for HTTP headers (RFC2616). I wonder what else […]

Validate GPX

$ xmllint –noout –schema http://www.topografix.com/GPX/1/1/gpx.xsd <gpx file or url>

Key-based FTP authentication

make a strong ssh key $ ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa turn to RFC 4716 $ ssh-keygen -e -f ~/.ssh/id_rsa.pub add to ~/.ssh/authorized_sftpkeys on destination host try out: $ curl -u “<username>:” –key ~/.ssh/id_rsa –pubkey ~/.ssh/id_rsa.pub -T <file to upload> sftp://<target host>/<target path>/ $ lftp -u <username>,xx … sftp://<target host> P.S.: Hetzner FAQ zum […]

Ad Blocking Proxy = abloprox

as an act of digital hygiene, I installed abloprox on a raspi and added this PAC file to save some keystrokes when configuring: function FindProxyForURL(url, host) { if (shExpMatch(host,"*.fritz.box")) return "DIRECT"; if (shExpMatch(host,"*.local")) return "DIRECT"; if (shExpMatch(host,"*.akamaistream.net")) return "DIRECT"; if (shExpMatch(host,"*.m945.mwn.de")) return "DIRECT"; // auto config: // 1. ensure there’s a host ‘wpad’ in the current […]

Opening Xcode projects and workspaces

Inspired by ortas post about it I came up with this one-liner: alias openx=’open *.xcworkspace 2>/dev/null || open *.xcodeproj 2>/dev/null || echo "nagnagnag"’

Download WWDC2014 session pdf + mov

. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!/bin/sh cd "$(dirname "$0")"   PREFIX=wwdc2014 bwlimit="1000K"   for url in $(curl https://developer.apple.com/videos/wwdc/2014/ | egrep -hoe ‘[^"]+.pdf[^"]+’) do dst="$PREFIX/$(basename $url ?dl=1)" echo "$dst" curl –output "$dst" –time-cond "$dst" –remote-time –silent –create-dirs –location –limit-rate "$bwlimit" –url […]

install ruby @ OS X

OS X comes with a pretty hung ruby (1.8.7) until ‘Mavericks’. ruby 1.8.7 had it’s planned EOL long ago, even debian/stable nowadays comes with a newer one. So if you’re still running Mountain Lion or older, you may need to install ruby. I chose rbenv and here’s how I did: RTFM install rbenv: $ brew […]

redmine (rails) + puma + lighttpd

Running redmine with a lightweight ruby on rails/webserver stack on a debian server – puma and lighttpd: Assumed you’ve got both redmine and lighttpd already installed: install puma gem: $ sudo gem install puma caution: ArgumentError on ruby 1.8.7 get tools/jungle/init.d/puma to /etc/init.d/ get tools/jungle/init.d/run-puma to /usr/local/bin/ add a puma app: $ sudo /etc/init.d/puma add /your/app/path www-data $ […]

Catch JavaScript exceptions in UIWebViews

A small but useful category method on UIWebView: Turn uncaught JavaScript Exception into a NSError! // // Created by Marcus Rohrmoser on 05.12.13. // Copyright (c) 2013 Marcus Rohrmoser mobile Software. All rights reserved. //   #import "UIWebView+JavaScriptNSError.h"   #define NSERROR_UIWEBVIEW_SCRIPT @"NSERROR_UIWEBVIEW_SCRIPT" #define NSERROR_UIWEBVIEW_SCRIPT_CODE 1   @implementation UIWebView(JavaScriptNSError)   -(NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script error:(NSError * __autoreleasing *)error […]