Skip to content

Instantly share code, notes, and snippets.

View toto's full-sized avatar

Thomas Kollbach toto

View GitHub Profile

Keybase proof

I hereby claim:

  • I am toto on github.
  • I am toto (https://keybase.io/toto) on keybase.
  • I have a public key whose fingerprint is 46E3 01C4 7F40 7696 8050 890A E2C7 AE4D AD30 A810

To claim this, I am signing this object:

@toto
toto / gist:5bac71f9bbe409b2a352
Created September 10, 2014 07:48
Check iOS System version
NSOperatingSystemVersion ios8_0_1 = (NSOperatingSystemVersion){8, 0, 1};
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:ios8_0_1]) {
// foo
}
@toto
toto / post-checkout
Created December 11, 2014 11:14
Put this in .git/hooks/post-checkout, make it executable with chmod u+x .git/hooks/post-checkout. Now git will complain when you have to do pod install after witching branches. You can also symlink it to .git/hooks/post-merge so it also is run after merge/pull
#!/bin/bash
#
# Let's you know when your pods should be updated right after a git pull or git merge
# Also works for fast-forward pulls.
#
# To enable this hook for your project, save it as .git/hooks/post-checkout
diff "Podfile.lock" "Pods/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
@toto
toto / makes_levenshtein gem_ruby_1.9_compatible.diff
Created March 23, 2009 16:08
Patch to make the levenshtein gem ruby 1.9 compatible
3,9d2
< /* Ruby 1.8 compatibility macros, these are defined in Ruby 1.9
< so the ones below will only be used in 1.8.x */
< #ifndef RSTRING_PTR
< # define RSTRING_PTR(s) (RSTRING(s)->ptr)
< # define RSTRING_LEN(s) (RSTRING(s)->len)
< #endif
<
22,23c15,16
< s1 = RSTRING_PTR(rb_s1);
@toto
toto / bridge-reset.sh
Created June 19, 2009 13:23
OpenVPN gets you out of your HTTP-Proxy misery (With some OpenSolaris specific details)
#!/bin/sh
# For OpenSolaris
# The Bridge module from http://www.whiteboard.ne.jp/~admin2/tuntap/
# brings a brdgadm tool
# Removing
# $1 is the interface which will be brought up
pfexec /usr/local/bin/brdgadm -d $1
# the Network card name your system uses to connect to your local network
pfexec /usr/local/bin/brdgadm -d rge0
pfexec /usr/local/bin/brdgadm -a $1
@toto
toto / heise-feed.rb
Created June 22, 2009 19:50
Produces Fulltext Feeds for Heise Online
#!/opt/local/bin/ruby
require 'rubygems'
require 'scrubyt'
require 'open-uri'
require 'builder'
LIMIT = 5
res = []
#!/usr/bin/env ruby
# Uses some commands to determine the OpenSolaris system state and
require 'rubygems'
gem 'twitter'
require 'twitter'
ME_ON_TWITTER = 'mrtoto'
httpauth = Twitter::HTTPAuth.new('email', 'password')
$twitter = Twitter::Base.new(httpauth)
@toto
toto / jabber-messanger-for-ci-joe.rb
Created August 17, 2009 18:20
A simple jabber bot that tells you how a build went and some basic meta info
#!/usr/bin/env ruby
#
require 'rubygems'
gem 'xmpp4r-simple'
gem 'grit'
require 'xmpp4r-simple'
require 'grit'
include Grit
toto@glow:~$ /usr/bin/rsync --version
rsync version 2.6.9 protocol version 29
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
inplace, IPv6, 64-bit system inums, 64-bit internal inums
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
@toto
toto / timeout_http_in_jruby.rb
Created September 16, 2009 15:16
Net/HTTP has some serious bugs regarding timeout in JRuby. Therefor it is useful to just use the Java classes to get a reliable timeout
require 'java'
import java.net
import java.io
uri = java.net.URL.new("http://127.0.0.1")
con = uri.openConnection()
con.setConnectTimeout(1000) # in millisecs so this is 1 sec
con.setReadTimeout(1000)