Skip to content

Instantly share code, notes, and snippets.

@markoa
markoa / git-svn-commands.txt
Created January 7, 2010 17:49
git-svn commands
# Clone a repo (like git clone):
git-svn clone svn+ssh://[email protected]/svn/paperbox
# You should be on master branch (check with git branch)
# After compiling, append svn:ignore settings to
# the default git exclude file:
git-svn show-ignore >> .git/info/exclude
# Do some work and commit locally to git:
git commit ...
@markoa
markoa / ruby-dbus-and-banshee.rb
Created January 7, 2010 17:30
ruby-dbus play with Banshee
#!/usr/bin/env ruby
require 'dbus'
bus = DBus::SessionBus.instance
banshee_service = bus.service("org.bansheeproject.Banshee")
banshee = banshee_service.object("/org/bansheeproject/Banshee/PlayerEngine")
puts banshee.introspect
@markoa
markoa / tumblr-json-parser.rb
Created January 4, 2010 11:44
Sketch for parsing JSON representation of a Tumblr blog.
#!/usr/bin/env ruby
# Parse Tumblr JSON.
require 'rubygems'
require 'json'
require 'net/http'
class String
@markoa
markoa / wordpressxml2jekyll.rb
Created January 4, 2010 09:48
Script to export posts from a Wordpress XML file to Jekyll (Textile) files. Collects comments in a YAML file too.
#!/usr/bin/env ruby
# Input: WordPress XML export file.
# Outputs: a series of Textile files ready to be included in a Jekyll site,
# and comments.yml which contains all approved comments with metadata which
# can be used for a Disqus import.
require 'rubygems'
require 'hpricot'
require 'clothred'
Sat May 02 13:20:05 +0200 2009
N is 1000
ruby is 1.8.7
Preparing data...
== PeopleMigration: reverting ================================================
-- drop_table(:people)
-> 0.0447s
== PeopleMigration: reverted (0.0450s) =======================================
@markoa
markoa / ar_mysql_vs_tc_table.rb
Created May 1, 2009 23:13
Benchmarking ActiveRecord + MySQL vs Tokyo Cabinet tables. Sample results at http://gist.github.com/105516
#!/usr/bin/env ruby
# Script to benchmark ActiveRecord + MySQL vs Tokyo Cabinet tables
require 'rubygems'
require 'benchmark'
require 'faker'
require 'date'
require 'fileutils'
require 'activerecord'