Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use Benchmark qw(:hireswallclock);
use Routes::Tiny;
my $routes = Routes::Tiny->new;
use strict;
use warnings;
use v5.10;
use Text::Caml;
use URI::Escape;
my $renderer = Text::Caml->new;
my $output;
# 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
#!/usr/bin/env starman
use strict;
use warnings;
use v5.10;
use AnyEvent;
use AnyEvent::Redis;
use JSON::XS;
use Plack::Request;
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
@und3f
und3f / deny-unknown-host
Created December 12, 2011 15:46
Nginx configuration to deny unknown hosts
server {
listen 80 default_server;
return 444;
}
#!/usr/bin/perl
use strict;
use warnings;
use Protocol::Redis;
use AnyEvent;
use AnyEvent::Socket;
my %commands = (
@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
@und3f
und3f / gist:2584816
Created May 3, 2012 09:58
Connect MIDI keyboard to midi2speaker
% aconnect -lo
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 16: 'M Audio Audiophile 24/96' [type=kernel]
0 'M Audio Audiophile 24/96 MIDI'
client 20: 'CME M-KEY' [type=kernel]
0 'CME M-KEY MIDI 1'
client 128: 'Midi2Speaker' [type=user]
0 'Input port '
% aconnect 20 128
@und3f
und3f / midi2speaker.pl
Created May 3, 2012 11:29
MIDI interface to the internal speaker
#!/usr/bin/env perl
use strict;
use warnings;
use Audio::Beep;
use MIDI::ALSA qw(
SND_SEQ_EVENT_NOTEON
SND_SEQ_EVENT_NOTEOFF
SND_SEQ_EVENT_PORT_UNSUBSCRIBED);