Skip to content

Instantly share code, notes, and snippets.

View danbri's full-sized avatar

Dan Brickley danbri

View GitHub Profile
!/usr/bin/ruby -rubygems
require 'json'
require 'net/http'
data=''
Net::HTTP.start('veetle.com', 80) do |http|
x = http.get('/channel-listing-cross-site.js').body
x.gsub!(/VEETLE\.channelList\.preFetch\(\);/,'')
x.gsub!(/VEETLE\.channelList\.list=/,'')
x.gsub!(/; VEETLE\.channelList\.postFetch\(\);/,'')
data = JSON.parse(x)
#!/usr/bin/ruby -rubygems
require 'json'
require 'net/http'
data=''
Net::HTTP.start('veetle.com', 80) do |http|
x = http.get('/channel-listing-cross-site.js').body
x.gsub!(/VEETLE\.channelList\.preFetch\(\);/,'')
x.gsub!(/VEETLE\.channelList\.list=/,'')
x.gsub!(/; VEETLE\.channelList\.postFetch\(\);/,'')
data = JSON.parse(x)
mysql> select ug_group, ug_user, user_name, user_real_name from user_groups, user where user_id = ug_user;
+------------+---------+--------------------+----------------------------+
| ug_group | ug_user | user_name | user_real_name |
+------------+---------+--------------------+----------------------------+
| bot | 2 | Danbri.org | Dan Brickley |
| bot | 64 | LibbyMiller | Libby Miller |
| bot | 94 | Steevc | |
| bot | 213 | DanBri | Dan Brickley |
| bureaucrat | 1 | WikiSysop | |
| bureaucrat | 2 | Danbri.org | Dan Brickley |
mysql> select * from user_openid;
+----------------------------------------------------------------------------------+----------+
| uoi_openid | uoi_user |
+----------------------------------------------------------------------------------+----------+
| http://danbri.org/ | 2 |
| http://www.w3.org/People/Berners-Lee/ | 3 |
| http://kidehen.idehen.net/dataspace/person/kidehen | 6 |
| http://www.wasab.dk/morten/ | 7 |
| http://sukinkot.livejournal.com/ | 8 |
| http://openid.osgeo.org/user/crschmidt | 9 |
@danbri
danbri / eastsidrocks.rb
Created December 3, 2010 13:27
read data from East Side Traders site
#!/usr/bin/ruby -rubygems
require 'open-uri'
base='http://www.visiteastside.co.uk/search_eastside/index.php?name=&&&offset=0#searchresults'
poidb = {}
# This Ruby script will extract data from the pages of the Visit East Side site.
#
# Notes:
# Please play nice and only use the data for purposes that further the goals of
!/usr/bin/ruby
require 'open-uri'
f = File.read('celebrities_profiles.txt')
f.each do |c|
fields = c.split(/\t/)
screen_name = fields[16];
url = fields[20];
# puts "Got: #{fields[16]} url: #{fields[20]}"
linkage = load '/user/danbri/wikipedia/dbpedia2twittername.txt.bz2' using PigStorage('\t') AS (dbpedia_entry: chararray, screen_name: chararray);
linked_topics = JOIN linkage by dbpedia_entry, WPSB1 by dbpedia_entry;
by_topics = GROUP linked_topics BY dbpedia_category;
cat_stats = FOREACH by_topics GENERATE group as category, COUNT(celeb_topics);
store cat_stats into 'edsu_topics';
Consumerism;Gender roles;Families: 1960s
[' Consumerism;Gender roles;Families: 1960s\n']
Suggested keywords:
Gender role,
Transgendered,
Academic,
Gender identity,
Gender,
@danbri
danbri / gist:863808
Created March 10, 2011 09:22
matlab svd tests
clf
hold on;
grid on;
# item labels
I = {
'Dr Who',
'Eastenders',
'Farmer Seeks Wife',
'Eurovision',
package tv.foaf;
import org.apache.mahout.common.RandomUtils;
import org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender;
import org.apache.mahout.cf.taste.impl.recommender.svd.Factorizer;
import org.apache.mahout.cf.taste.impl.recommender.svd.SVDRecommender;
import org.apache.mahout.cf.taste.impl.recommender.svd.ALSWRFactorizer;
import org.apache.mahout.cf.taste.impl.recommender.svd.ExpectationMaximizationSVDFactorizer;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.eval.IRStatistics;