Skip to content

Instantly share code, notes, and snippets.

@b10m
b10m / nsca2gearman.pl
Created August 6, 2014 09:02
A little nsca proxy server that accepts connections and dumps the passive results in the gearman queue for mod_gearman to pick up.
use strict;
use Config::Simple;
use Crypt::Rijndael;
use Gearman::Client;
use MIME::Base64;
use POE;
use POE::Component::Server::NSCA;
my $c = Config::Simple->new('/etc/nagios/nsca2gearman.cfg.erb') or die Config::Simple->error();
my $cipher = Crypt::Rijndael->new($c->param('gearman'), Crypt::Rijndael::MODE_ECB());
@b10m
b10m / gist:f3fca1263de8cf4c4be3
Created July 7, 2014 15:58
Flickr https bypass
<VirtualHost *:80>
ServerName www.flickr.com
SSLProxyEngine On
ProxyPass / https://www.flickr.com/
CustomLog /var/log/apache2/flickr-access combined
ErrorLog /var/log/apache2/flickr-error
</VirtualHost>
@b10m
b10m / keybase.md
Created June 24, 2014 13:37
Keybase

Keybase proof

I hereby claim:

  • I am b10m on github.
  • I am b10m (https://keybase.io/b10m) on keybase.
  • I have a public key whose fingerprint is 8D40 C460 B102 E684 D24A 4449 BAC0 170E 5A07 F801

To claim this, I am signing this object:

@b10m
b10m / check_klm.pl
Created August 26, 2013 13:02
To monitor flights from AMS to CGK I decided to let Nagios do that for me. It now alerts me when prices drop to the wanted 799 EUR. It also spits the metric to a graphite box running on localhost to please @ainmosni.
#!/usr/bin/perl
use strict;
use LWP::Simple qw( get );
use XML::Simple qw( XMLin );
use Nagios::Plugin;
use Net::Graphite;
my $np = Nagios::Plugin->new;
$np->set_thresholds(ok => '~:900', warning => '@800:900', critical => '799:');
@b10m
b10m / hogent_sniper.pl
Created January 31, 2013 16:03
HoGent allowed 20 accounts internet access at a time. I'm to lazy to snipe a free position and use this }:-)
use strict;
use LWP::UserAgent;
my $url = 'https://webauthentication.hogent.be/login.html';
my @passwords = qw( insert passwords here o_O );
my $ua = LWP::UserAgent->new();
for( my $i = 0; $i < @passwords; $i++) {
my $user = sprintf("hgguest%02d", $i+1);
@b10m
b10m / pretty_print.bash
Created November 11, 2012 08:55
Pretty printing (JSON/XML) from the commandline
menno@samael:~$ curl 'https://api.linode.com/?api_key=abc123&api_action=test.echo&api_responseFormat=json'
{"ERRORARRAY":[{"ERRORCODE":4,"ERRORMESSAGE":"Authentication failed"}],"DATA":{},"ACTION":"test.echo"}
menno@samael:~$ curl -s 'https://api.linode.com/?api_key=abc123&api_action=test.echo&api_responseFormat=json' | python -mjson.tool
{
"ACTION": "test.echo",
"DATA": {},
"ERRORARRAY": [
{
"ERRORCODE": 4,
@b10m
b10m / money_not_gone_up_in_smoke.pl
Created November 2, 2012 09:02
Outputs the amounts of euros I've saved since I quite smoking
#!/usr/bin/perl
use DateTime;
use Mojo::UserAgent;
my $price =
Mojo::UserAgent->new
->get( 'http://www.ah.nl/appie/producten?rq=Gauloises+Blondes+Blue' )
->res->dom->find("p.price")->first->all_text;
$price =~ s/[^0-9\.]//g;
@b10m
b10m / Wiki tag generator
Created October 29, 2012 15:23
Fetch a random animal name suited for wiki page tagging
$ perl -MMojo::UserAgent -le 'Mojo::UserAgent->new->detect_proxy
->get("http://en.wikipedia.org/wiki/Chart_of_English_animal_nouns")
->res->dom->find("table.wikitable tr td a")
->shuffle->slice(0..2)->each(sub { print $_->text } );'