Skip to content

Instantly share code, notes, and snippets.

View jberkel's full-sized avatar

Jan Berkel jberkel

View GitHub Profile
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:
@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?
@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:passwd@api.del.icio.us/v1/posts/all > posts.xml
#!/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)
#!/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
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):
def submodules
(self.constants.map{|const| const_get(const)}.select{|const| const.is_a? Module}.map{|const| const.submodules} << self).flatten
end
set mainfont {Monaco 12}
set textfont {Monaco 12}
set uifont {"Monaco Bold" 12}
set tabstop 8
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set autoselect 1
curl -s http://aserver.com/path/file.csv | ruby -rcsv -e 'puts CSV.parse($stdin.read).map { |a,b| "#{a}\t#{b}" }.join("\n")' | pbcopy
require 'ffi'
module Exec
extend FFI::Library
attach_function :my_exec, :execl, [:string, :string, :varargs], :int
attach_function :fork, [], :int
end
vim1 = '/usr/bin/vim'