Skip to content

Instantly share code, notes, and snippets.

View jberkel's full-sized avatar

Jan Berkel jberkel

View GitHub Profile
def submodules
(self.constants.map{|const| const_get(const)}.select{|const| const.is_a? Module}.map{|const| const.submodules} << self).flatten
end
#!/usr/bin/env python
import sys
import csv
from datetime import timedelta, datetime
from graphication import FileOutput, Series, SeriesSet, Label, SimpleScale, css, default_css as style
from graphication.scales.date import AutoWeekDateScale, AutoDateScale
from graphication.wavegraph import WaveGraph
def colorgen(colours):
#!/usr/bin/ruby
require "twitter"
user = ARGV[0]
File.open("data/users/#{user}", "w") do |o|
Twitter.all_tweets(user) do |tweet|
o.puts tweet["text"]
end
end
#!/usr/bin/env python
#http://hse-at-work.blogspot.com/2006/11/color-scheme-generator-for-charts.html
from random import randint
class Color:
__c = [0, 0, 0]
__cB = None
def __init__(self, r=-1, g=-1, b=-1):
if r == -1:
r = randint(1,255)
@jberkel
jberkel / posts.py
Created June 23, 2009 02:32
create streamgraphs from delicious history
#!/usr/bin/env python
import lxml.etree
import xml.utils.iso8601
from datetime import datetime, timedelta
from graphication import FileOutput, Series, SeriesSet, Label, SimpleScale, css, default_css as style
from graphication.scales.date import AutoWeekDateScale, AutoDateScale
from graphication.wavegraph import WaveGraph
"""
curl https://user:[email protected]/v1/posts/all > posts.xml
@jberkel
jberkel / shp2kml.rb
Created July 7, 2009 23:13
shapefile 2 kml
#!/usr/bin/env ruby
require 'rubygems'
require 'kml'
require 'shapelib'
include ShapeLib
raise "#{$0} <filename>" if ARGV.empty?
import dispatch.json.Js
Js(""" {"foo":{}} """)
Js(""" {"foo":{"bar":{}}} """)
Js(""" {"foo":{"bar":{}, "braz": 0 }} """)
Js(""" {"foo":{"bar":{}, "braz": 0, "moz":1}} """)
// ^^ bombs here
zegoggles.gigjet.tests.FetcherTests:
Error in testJsonParser:
[{"in_reply_to_user_id": null, "text": "s/Bürgerthemen/Bürgerrechte/ gna", "user": {"following": true, "profile_sidebar_border_color": "87bc44", "description": "Diskordischer Evangelist. Moderator der Podcasts Chaosradio Express, dieGesellschafter, Not Safe For Work und mobileMacs.", "utc_offset": 3600, "profile_text_color": "000000", "profile_image_url": "http://s3.amazonaws.com/twitter_production/profile_images/124176546/Tim_Pritlove_2009_Logo_256x256_normal.jpg", "profile_background_image_url": "http://s3.amazonaws.com/twitter_production/profile_background_images/7640402/live-arcade-matrix-quai-huge.jpg", "created_at": "Mon Dec 17 22:25:51 +0000 2007", "url": "http://tim.geekheim.de/", "name": "Tim Pritlove", "profile_link_color": "0000ff", "followers_count": 6419, "protected": false, "screen_name": "timpritlove", "profile_background_tile": false, "statuses_count": 4247, "friends_count": 356, "profile_background_color": "9ae4e8", "notifications": false, "verified": false, "favourites_count": 487, "profile_
@jberkel
jberkel / gist:147698
Created July 15, 2009 13:21
twitter_friends_timeline.json
[{"in_reply_to_user_id":null,"text":"s\/B\u00fcrgerthemen\/B\u00fcrgerrechte\/ gna","user":{"following":true,"profile_sidebar_border_color":"87bc44","description":"Diskordischer Evangelist. Moderator der Podcasts Chaosradio Express, dieGesellschafter, Not Safe For Work und mobileMacs.","utc_offset":3600,"profile_text_color":"000000","profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/124176546\/Tim_Pritlove_2009_Logo_256x256_normal.jpg","profile_background_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_background_images\/7640402\/live-arcade-matrix-quai-huge.jpg","created_at":"Mon Dec 17 22:25:51 +0000 2007","url":"http:\/\/tim.geekheim.de\/","name":"Tim Pritlove","profile_link_color":"0000ff","followers_count":6419,"protected":false,"screen_name":"timpritlove","profile_background_tile":false,"statuses_count":4247,"friends_count":356,"profile_background_color":"9ae4e8","notifications":false,"verified":false,"favourites_count":487,"profile_sidebar_fill_color"
W/dalvikvm( 1041): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
E/AndroidRuntime( 1041): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1041): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.jruby/org.jruby.IRB}: org.jruby.exceptions.RaiseException: no such file to load -- builtin/core_ext/symbol
E/AndroidRuntime( 1041): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
E/AndroidRuntime( 1041): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 1041): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime( 1041): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime( 1041): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1041): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1041): at android.app.ActivityThread.main(ActivityThread.java:4203)