Skip to content

Instantly share code, notes, and snippets.

View moonhouse's full-sized avatar

David Hall moonhouse

View GitHub Profile
# Client to control electrical appliances based on Twitter activity.
# Uses Tellstick USB (using Remotestick REST API http://wiki.github.com/pakerfeldt/remotestick/ ) and
# the Twitter API.
import twitter
import time
import httplib
api = twitter.Api()
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/tomaswennstrom" -O twitter/twitterqr/1.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/kristinheinonen" -O twitter/twitterqr/2.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/findub" -O twitter/twitterqr/3.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/Alexlundborg" -O twitter/twitterqr/4.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/bjornjeffery" -O twitter/twitterqr/5.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/miriamolsson" -O twitter/twitterqr/6.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/macsolve" -O twitter/twitterqr/7.png
wget "http://chart.apis.google.com/chart?chs=450x450&cht=qr&chl=http://m.twitter.com/chronix" -O twitter/twitterqr/8.png
wget "http://chart.apis.go
@moonhouse
moonhouse / gist:790247
Created January 21, 2011 19:29
Cloudvox test
[{"name":"Speak","phrase":"It works. Enter 4 digits!"},
{"name":"GetDigits","url":"http://moonhouse.se/url-to-hit-with-result.json","max":4},
{"name":"Playback","filename":"airport"},
{"name":"Playback","filename":"north-dakota"}
]
resin01
[110124 15:06:44] Completed 200 OK in 11403ms (Views: 1.0ms)
[110124 15:11:21] Completed 200 OK in 17588ms (Views: 1.0ms)
[110124 15:11:29] Completed 200 OK in 20115ms (Views: 2.0ms)
[110124 15:21:12] Completed 200 OK in 11249ms (Views: 47.0ms)
[110124 15:42:06] Completed 200 OK in 56854ms (Views: 1.0ms)
[110124 15:42:06] Completed 200 OK in 48723ms (Views: 1.0ms)
[110124 15:42:06] Completed 200 OK in 57663ms (Views: 1.0ms)
[110124 15:49:28] Completed 200 OK in 24672ms (Views: 1.0ms)
@moonhouse
moonhouse / exempel.xml
Created March 9, 2011 12:15
De 10 första träffarna från en XML där ett av fälten innehåller ett speciellt ord
<?xml version="1.0" encoding="UTF-8"?>
<universe>
<numbers>
<number>ett</number>
<number>två</number>
<number>tre</number>
<number>fyra</number>
<number>fem</number>
<number>sex</number>
<number>sju</number>
@moonhouse
moonhouse / getimagelinks.rb
Created August 26, 2011 08:56
Ruby script to get thumbnails (OpenGraph style) from video pages
@moonhouse
moonhouse / report-jobs.rb
Created November 16, 2011 11:37
Parse Jenkins builds and HTTP POST summaries.
require 'nokogiri'
require 'httparty'
def is_build_no(dir_name)
(dir_name =~ /\/\d*$/) != nil
end
def is_build_time(dir_name)
# Match paths ending with timestamps such as 2011-10-17_15-06-32
(dir_name =~ /\/\d*-\d*-\d*_\d*-\d*-\d*$/) != nil
@moonhouse
moonhouse / list_blogs.rb
Created December 1, 2011 10:54
Retrieve feed information from WPMU server given a dump of the page /wp-admin/my-sites.php in blogdump.html
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('blogdump.html'))
doc.xpath('//select[@name="primary_blog"]/option').each do |link|
blog_url = link.content
begin
rss = Nokogiri::XML(open("#{blog_url}/feed/"))
@moonhouse
moonhouse / geo_conv.rb
Created May 5, 2012 14:15
Convert RT90 to WGS84
def convert_rt90_to_wgs84(geopos)
# from http://mellifica.se/geodesi/gausskruger.js
geopos=geopos.first
x = geopos['x'].to_i
y = geopos['y'].to_i
axis = 6378137.0 # GRS 80.
flattening = 1.0 / 298.257222101 # GRS 80.
central_meridian = 15.0 + 48.0/60.0 + 22.624306/3600.0
@moonhouse
moonhouse / diarium.rb
Created December 20, 2012 22:13
Skapa RSS för dagens diarium från en av länsstyrelserna
# encoding: UTF-8
require 'mechanize'
require 'builder'
@agent = Mechanize.new
def get_list(diary_id)
page = @agent.get("http://diarium.lansstyrelsen.se/default.aspx")
form = page.form('aspnetForm')