Skip to content

Instantly share code, notes, and snippets.

View beppu's full-sized avatar

John Beppu beppu

View GitHub Profile
@scottwalters
scottwalters / gist:8220a1e60469ad3ef990
Created August 21, 2014 12:59
when perl code stops working on a newer version of perl
( perl5.12.3 -d:Trace t/013_complexType.t 2>&1) | grep -v '/home/scott/lib/' | sed -e 's!lib//SOAP!lib/SOAP!' > trace512.txt
( perl -d:Trace t/013_complexType.t 2>&1) | grep -v '/usr/local/lib/perl5/' > trace519.txt
# For example... the library paths to grep out vary (5.12.3 was installed in my home dir whereas 5.19.9 is in /usr/local).
kompare trace*.txt
That creates full execution traces, showing every line that Perl runs, while running the same unit test under two different versions of Perl. grep -v removes all lines traced from running installed modules so that only tracing from the unit test and non-installed module are left. kompare does a visual comparison on that. The point in the code where execution diverges for whatever reason will be clear in the visual diff.
@aphyr
aphyr / gist:3200862
Created July 29, 2012 18:30
Clojure message passing test
(ns messagepassing.core)
(import [java.util.concurrent LinkedTransferQueue])
(def m 10000000)
(defn queue-test []
(defn bounce [in out m]
(let [value (.take in)]
(if (< value m)
(do
@aphyr
aphyr / gist:3200829
Created July 29, 2012 18:29
Node.js message passing test
var cluster = require('cluster');
var m = 10000000;
function bounce(msg, out) {
if (msg < m) {
out.send(msg + 1);
return null;
} else {
console.log("Finished with", msg);
;; ninjudd's solution to http://4clojure.com/problem/26
#(take % ((fn fib [a b]
(lazy-seq
(cons b (fib b (+ a b))))) 0 1))
@awwaiid
awwaiid / myboardgame.pl
Created April 25, 2011 19:46
Linux Format Perl Redone
#!/usr/bin/perl
use strict;
use Image::Magick;
# auxiliary variables
my $img_id = 0; #loop index
my @ordered_squares;
my $rotation = 180;
#Width and Height of each box, squares per side
@beppu
beppu / video.google.com-download
Created April 23, 2011 11:51
on STDIN, give this script a list of google video urls, and it will download them.
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
use URI;
use URI::QueryParam;
use URI::Escape;
while(<>) {
my ($url, $title) = split(/\|/);
@beppu
beppu / imgur
Created October 27, 2010 10:00
If you ever need to bulk upload many URLs to imgur.com, this is the tool for you.
#!/usr/bin/env perl
use common::sense;
use AnyEvent;
use AnyEvent::HTTP;
use JSON;
# Get your API key here:
# http://imgur.com/register/api_anon
my $imgur_api_key = '69696969696969696969696969696969'; # XXX - replace me
my $imgur_upload = 'http://api.imgur.com/2/upload.json';