Skip to content

Instantly share code, notes, and snippets.

View atog's full-sized avatar

Koen Van der Auwera atog

View GitHub Profile
@atog
atog / .gitignore
Created September 17, 2008 11:04
Backup your iTunes library to Amazon S3
itunes-s3.yml
# initializer solution for paperclip + passenger combo
# Paperclip::Attachment#post_process => "/tmp/stream.3916.0 is not recognized by the 'identify'
# command" error.
if RAILS_ENV == "development"
Paperclip.options[:image_magick_path] = "/opt/local/bin"
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.195 0.195 0.195</string>
<key>InsertionPoint</key>
<string>0.902 0.902 0.902</string>
require "net/http"
def twit(username, password, status, timeout=10)
response = Net::HTTP.start('twitter.com', 80) do |http|
req = Net::HTTP::Post.new("/statuses/update.xml")
req.set_form_data({'status'=> status})
req.basic_auth(username, password)
http.read_timeout = timeout
http.request(req)
end
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
end
@config[key]
end
@atog
atog / license
Created January 27, 2010 10:33 — forked from defunkt/license
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
year=`date "+%Y"`
cat <<EOF
Copyright (c) $year Chris Wanstrath
Permission is hereby granted, free of charge, to any person obtaining
require "rubygems"
require "hpricot"
doc = Hpricot.XML(`tumblr read num=10`)
(doc/"post").each do |p|
puts `tumblr delete post-id=#{p.attributes['id']}`
end
@atog
atog / rinari
Created May 25, 2010 09:36 — forked from pjaspers/rinari
Restart passenger from emacs
;; As seen on
;; http://lucky-dip.net/articles/2009/08/06/restart-passenger-from-emacs-using-rinari/
;; Anyway, here is a small snippet of emacs lisp to easily restart the
;; Passenger server for the project you are currently working on. It
;; assumes you have Rinari installed.
(defun restart-passenger ()
"Restart passenger using the current rinari root" (interactive)
(shell-command (concat "touch " (rinari-root) "tmp/restart.txt"))
(message "Passenger restarted"))
@atog
atog / tumblr_cleaner.rb
Created December 29, 2010 13:58
Delete tumblr posts
require "rubygems"
require "hpricot"
doc = Hpricot.XML(`tumblr read num=10`)
(doc/"post").each do |p|
puts `tumblr delete post-id=#{p.attributes['id']}`
end
@atog
atog / prinses.rb
Created December 30, 2010 13:31
Prinses en de kikker kleurplaten
`wget http://www.kids-n-fun.nl/kleurplaten/prinses%20en%20de%20kikker/prinsess_en_kikker_#{sprintf("%02d", i)}.jpg`