Skip to content

Instantly share code, notes, and snippets.

Björn Höhrmann hoehrmann

Block or report user

Report or block hoehrmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View google-geocode-easteregg.json
{
"results" : [
{
"address_components" : [
{
"long_name" : "\u003ca href=http://localhost:20000/form/DataTool.view_region?submit=Send+to+RPC&3=t&3.1=-22.467512&3.1.=y&3.2=-42.655755&3.2.=y&3.3=2.500000&3.3.=y&3.4=0.000000&3.4.=y&3.5=0.071465&3.5.=y&3.6=-1.143429&3.6.=y&database=mapmaker_prod\u003eSV pose\u003c/a\u003e",
"short_name" : "\u003ca href=http://localhost:20000/form/DataTool.view_region?submit=Send+to+RPC&3=t&3.1=-22.467512&3.1.=y&3.2=-42.655755&3.2.=y&3.3=2.500000&3.3.=y&3.4=0.000000&3.4.=y&3.5=0.071465&3.5.=y&3.6=-1.143429&3.6.=y&database=mapmaker_prod\u003eSV pose\u003c/a\u003e",
"types" : [ "route" ]
},
{
@hoehrmann
hoehrmann / google-phonetic.pl
Created Feb 14, 2014
Google Translate phonetic (english-only?) transliterations
View google-phonetic.pl
#!perl -w
use strict;
use warnings;
use LWP::UserAgent;
use URI;
use JSON;
use YAML::XS;
my $uri = URI->new('http://translate.google.com/translate_a/t');
@hoehrmann
hoehrmann / fetch-ngrams-data.pl
Created Mar 18, 2014
How to fetch Google Ngrams data
View fetch-ngrams-data.pl
my $url = URI->new('http://books.google.com/ngrams/graph');
$url->query_form(
year_start => 1800,
year_end => 2000,
corpus => $corpus,
smoothing => 30,
content => encode_utf8($q),
);
View node-js-http-proxy-capturing-audio-mpeg-files.js
var httpProxy = require('http-proxy');
var http = require('http');
var fs = require('fs');
var proxy = httpProxy.createProxyServer({
target:'http://localhost:9005'
});
proxy.listen(8005);
@hoehrmann
hoehrmann / lastfm-user-toptracks-tags.pl
Last active Aug 29, 2015
For a given last.fm user, retrieves all their top tracks, and for each track, all tags for the track, and then prints out the 7 most-used tags for each track.
View lastfm-user-toptracks-tags.pl
#!/usr/bin/env perl -w
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use URI;
use URI::QueryParam;
my $ua = LWP::UserAgent->new;
@hoehrmann
hoehrmann / music_related_youtube_videos.pl
Created Jan 13, 2012
Searches YouTube for artist + title of some musical composition and prints out details about videos related to the first result (in other words, it finds related music and other content)
View music_related_youtube_videos.pl
View gist:2286936
#!perl -w
use strict;
use warnings;
use IO::Unread 'unread';
use Data::Dumper;
sub read_line_group {
my ($handle, $key_regex) = @_;
my $previous_key;
my @lines;
@hoehrmann
hoehrmann / gist:2313504
Created Apr 5, 2012
Extract tabular data from PDFs (after using pdftohtml -c -xml)
View gist:2313504
#!perl -w
use strict;
use warnings;
use XML::LibXML;
use List::Util qw/max/;
use Math::Trig qw/:pi deg2rad rad2deg/;
my $d = XML::LibXML->load_xml(location => 'wurdlist.xml');
my $m = deg2rad( 3 );
@hoehrmann
hoehrmann / gist:2340570
Created Apr 9, 2012
Download plain text versions of public domain books from EXAMPLE Books.
View gist:2340570
#!perl -w
use strict;
use warnings;
use LWP::UserAgent;
use HTML::FormatText;
die "Usage: $0 bookid > example.txt\n" unless @ARGV == 1;
my $book = shift @ARGV;
my %seen;
@hoehrmann
hoehrmann / gist:2393552
Created Apr 15, 2012
Quick and dirty run lengths
View gist:2393552
sub run_lengths {
return unless @_ > 0;
my $prev = shift @_;
my @runs = [$prev, 1];
for (@_) {
if ($_ eq $prev) {
$runs[-1]->[1]++;
next;
}
push @runs, [$_, 1];
You can’t perform that action at this time.