Skip to content

Instantly share code, notes, and snippets.

@und3f
und3f / no-more-blues.pl
Created May 2, 2012 20:40
No more blues with internal speaker
use Audio::Beep; Audio::Beep->new->play(join ' ', <DATA>);
__DATA__
\bpm240
f2 a, d2. f4 e2 b2 d2.
e4 f2 bes cis2.
f4 e d8 f4 f6 e d a1
f'2 a,2 b d c4 e2
r4 e d c c4 bes2
r4 f e d d cis e c bes2. r4
#!/usr/bin/perl
use strict;
use warnings;
use Protocol::Redis;
use AnyEvent;
use AnyEvent::Socket;
my %commands = (
@und3f
und3f / deny-unknown-host
Created December 12, 2011 15:46
Nginx configuration to deny unknown hosts
server {
listen 80 default_server;
return 444;
}
2011/12/12 12:25:15 [error] 26084#0: *1301137 open() "/usr/share/nginx/html/proxy-1.php" failed (2: No such file or directory), client: 58.218.199.147, server: localhost, request: "GET http://www.seektwo.com/proxy-1.php HTTP/1.1", host: "www.seektwo.com"
2011/12/12 13:57:34 [error] 26085#0: *1301874 open() "/usr/share/nginx/html/judge112233.php" failed (2: No such file or directory), client: 58.218.199.250, server: localhost, request: "GET http://218.83.152.252/judge112233.php HTTP/1.1", host: "218.83.152.252"
2011/12/12 16:28:17 [error] 26084#0: *1303993 open() "/usr/share/nginx/html/proxyheader.php" failed (2: No such file or directory), client: 58.218.199.250, server: localhost, request: "GET http://www.mpwallpapers.com/proxyheader.php HTTP/1.1", host: "www.mpwallpapers.com"
2011/12/12 16:29:30 [error] 26086#0: *1304103 open() "/usr/share/nginx/html/pr.php" failed (2: No such file or directory), client: 58.218.199.250, server: localhost, request: "GET http://www.intute.us/pr.php HTTP/1.1", host: "www.intut
#!/usr/bin/env starman
use strict;
use warnings;
use v5.10;
use AnyEvent;
use AnyEvent::Redis;
use JSON::XS;
use Plack::Request;
# Add "get_board_info" helper
$app->helper(
get_board_info => sub {
my $c = shift;
my $data_id = shift;
my @keys = @_;
my $aecv = AE::cv;
my %data;
$aecv->begin (sub { shift->send(\%data) }); # Outer CV
use strict;
use warnings;
use v5.10;
use Text::Caml;
use URI::Escape;
my $renderer = Text::Caml->new;
my $output;
#!/usr/bin/env perl
use strict;
use warnings;
use Benchmark qw(:hireswallclock);
use Routes::Tiny;
my $routes = Routes::Tiny->new;
SELECT
sender.jid || COALESCE('/' || sender_resource, '') AS sender,
recipient.jid || COALESCE('/' || recipient_resource, '') AS recipient,
message.id, message.type, message.body, message.thread
FROM messages message
JOIN identificators sender
ON sender.id = message.sender
JOIN identificators recipient
ON recipient.id = message.recipient
@und3f
und3f / author.pl
Created August 9, 2011 22:10
Find who depends on authors modules
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
my $METACPAN = 'http://api.metacpan.org/v0';