Skip to content

Instantly share code, notes, and snippets.

View georgkreimer's full-sized avatar
☠️
Hack the planet!

Georg Kreimer georgkreimer

☠️
Hack the planet!
View GitHub Profile
@georgkreimer
georgkreimer / spotify_mute_ads.rb
Created June 14, 2012 14:52 — forked from v1rtual/spotify_mute_ads.rb
Mute Spotify ads on OS X
# coding: utf-8
#!/usr/bin/env ruby
#
# Mutes Spotify ads by monitoring Growl's output in syslog, and changing the
# system-wide audio output to dummy output when an ad is detected.
#
# == Installation
#
# 1. Install Soundflower (http://code.google.com/p/soundflower/)
# 2. download gist
@georgkreimer
georgkreimer / sphinx.rb
Created May 13, 2012 22:18 — forked from alexstubbs/sphinx.rb
Brew formula for install sphinx 0.9.8.1 based on homebrew formula sphinx 2.0.4 git checkout 8dbb32e /usr/local/Library/Formula/sphinx.rb
require 'formula'
class Libstemmer < Formula
# upstream is constantly changing the tarball,
# so doing checksum verification here would require
# constant, rapid updates to this formula.
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
homepage 'http://snowball.tartarus.org/'
end
@georgkreimer
georgkreimer / gist:2654007
Created May 10, 2012 15:42 — forked from marcel/gist:2100703
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@georgkreimer
georgkreimer / hack.sh
Created March 31, 2012 18:36 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@georgkreimer
georgkreimer / face_detector.rb
Created December 7, 2011 17:30 — forked from pvinis/face_detector.rb
run with "macruby face_detector.rb" or "macruby face_detector.rb https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/304055_10150415385415891_522505890_10347873_1682210515_n.jpg?dl=1" for a photo of me with woody and buzz lightyear :p
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],
@georgkreimer
georgkreimer / omg.rb
Created October 28, 2011 23:39 — forked from tenderlove/omg.rb
###
# Read in XML as a stream, write out JSON as a stream. As little information
# is kept in memory as possible.
require 'nokogiri'
require 'psych'
class JSONTranslator < Nokogiri::XML::SAX::Document
attr_reader :emitter
def initialize emitter
class MappedHash < Hash
attr_writer :mappings
def mappings
@mappings || {}
end
def [](name)
super || super(mappings[name])
end
@georgkreimer
georgkreimer / gist:1276091
Created October 10, 2011 18:23 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@georgkreimer
georgkreimer / ruby-1.9-tips.rb
Created October 9, 2011 18:45 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
# extensions
# …
module SOAPArray
def to_soap_array(item_name = "messageId")
result=Array.new
self.each do |val|
result.push({item_name => val.to_i})
end
result
end