Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Pod::Usage qw( pod2usage );
use Hannibal;
my ( $command ) = @ARGV;
die "Specify a command: init, update" unless $command;
@preaction
preaction / 6to4.pl
Last active December 28, 2016 07:13
use v5.014;
use NetAddr::IP::Util qw( inet_aton ipv6_ntoa );
my $ipv4 = "192.168.125.2";
my $v4n = inet_aton( $ipv4 );
my $proxy_addr = pack( 'H4', 2002 ) . $v4n . pack( 'H20', 0 );
say unpack( 'H*', $proxy_addr );
my $ipv6 = ipv6_ntoa( $proxy_addr );
say $ipv6;
@preaction
preaction / test.pl
Last active November 30, 2016 21:57
use v5.020;
use warnings;
use Mojo::UserAgent;
sub bsos_helper {
my ( $server ) = @_;
my $ua = Mojo::UserAgent->new;
# XXX: Set proxy on $ua here
$ua->on( start => sub {
id guid state postdate tester dist version platform perl osname osvers fulldate type uploadid
75477437 09023b0a-b35f-11e6-aba1-8c74ec95371a pass 201611 [email protected] CPAN-Reporter 1.2018 x86_64-linux-gnu-thread-multi 5.20.2 linux 3.16.0-4-amd64 201611252232 2 277742
75477453 3c94ff2a-b35f-11e6-b499-758cec95371a pass 201611 [email protected] Term-Title 0.08 x86_64-linux-gnu-thread-multi 5.20.2 linux 3.16.0-4-amd64 201611252233 2 221215
75477454 3fbcd7f4-b35f-11e6-b499-758cec95371a pass 201611 [email protected] Number-Compare 0.03 x86_64-linux-gnu-thread-multi 5.20.2 linux 3.16.0-4-amd64 201611252233 2 162690
75477456 41571f84-b35f-11e6-b499-758cec95371a pass 201611 [email protected] Text-Glob 0.10 x86_64-linux-gnu-thread-multi 5.20.2 linux 3.16.0-4-amd64 201611252233 2 281743
75477457 42c5ce06-b35f-11e6-b499-758cec95371a pass 201611 [email protected] File-Find-Rule 0.34 x86_64-linux-gnu-thread-multi 5.20.2 linux 3.16.0-4-amd64 201611252234 2 265054
75477458 44dad27c-b35f-11e6-b499-758cec95371a pass 201611 athre
@preaction
preaction / bench.pl
Last active November 22, 2016 18:14
Benchmark of using Module::Runtime to load Beam::Listener every time
use v5.024;
use warnings;
use Benchmark qw( cmpthese );
use Module::Runtime qw( use_module require_module module_notional_filename );
use Beam::Listener;
my $cb = sub { };
cmpthese( -5, {
mysql> explain SELECT `me`.`dist`, `me`.`version`, `me`.`pass`, `me`.`fail`, `me`.`na`, `me`.`unknown` FROM `release_summary` `me` JOIN `cpanstats` `report` ON `report`.`guid` = `me`.`guid` WHERE ( ( `patched` = 1 AND `perlmat` = 1 AND `report`.`fulldate` >= 201610250000 ) );
+----+-------------+--------+------------+------+------------------------------------------+-------------+---------+-------------------+--------+----------+--------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+--------+------------+------+------------------------------------------+-------------+---------+-------------------+--------+----------+--------------------------+
| 1 | SIMPLE | me | NULL | ref | maturity,maturity_patched,ix_join_report | maturity | 2 | const | 316745 | 10.00 | Using where |
| 1 | SIM
@preaction
preaction / gist:fe9f18ab7816566d3bbbef9a62b04099
Created October 25, 2016 20:57
Youtube videos posted to #css by theskillwithin in the last two months
gwen Channels/#css » ack 'youtube\.com' 2016-{09,10}* | grep theskillwithin | grep -v nsfw | egrep -o 'https?://[^/]+youtube.com/[^ )]+' | sort -u
https://www.youtube.com/playlist?list=PLqGj3iMvMa4IyCbhul-PdeiDqmh4ooJzk
https://www.youtube.com/playlist?list=PLqGj3iMvMa4KeBN2krBtcO3U90_7SOl-A
https://www.youtube.com/playlist?list=PLqGj3iMvMa4L731ispRfGAabXeRpM4RL6
https://www.youtube.com/playlist?list=PLqGj3iMvMa4LE0uTAwo9wIFQYuGhIu7Gw
https://www.youtube.com/playlist?list=PLqGj3iMvMa4LvJ8VctoXnPI0dtE40wfid
https://www.youtube.com/user/DevTipsForDesigners
https://www.youtube.com/user/DevTipsForDesigners/playlists?sort=dd&view=1&shelf_id=0
https://www.youtube.com/watch?v=hIG-fZ2042k
@preaction
preaction / post-embed-directive.html
Created October 24, 2016 18:23
OEmbed example syntaxes
<p>This is a cool video I found!</p>
<video src="http://youtube.com/watch/VIDEO_ID"></video>
<p>Isn't it cool?</p>
@preaction
preaction / uploads.txt
Created October 21, 2016 15:42
Information in the uploads database of CPAN Testers
mysql> select * from uploads limit 10;
+----------+------+---------+---------------------+---------+------------------------------+------------+
| uploadid | type | author | dist | version | filename | released |
+----------+------+---------+---------------------+---------+------------------------------+------------+
| 1 | cpan | LREEVES | DBI-ResultPager | 0.9.0 | DBI-ResultPager-0.9.0.tar.gz | 1131570943 |
| 2 | cpan | LREEVES | DBI-ResultPager | 0.9.1 | DBI-ResultPager-0.9.1.tar.gz | 1132078122 |
| 3 | cpan | LROCHER | Win32-GUI-Scintilla | 1.7 | Win32-GUI-Scintilla-1.7.zip | 1077985028 |
| 4 | cpan | LROCHER | Win32-GUI-AxWindow | 0.07 | Win32-GUI-AxWindow-0.07.zip | 1078429322 |
| 5 | cpan | LROCHER | Win32-GUI-AxWindow | 0.06 | Win32-GUI-AxWindow-0.06.zip | 1069510585 |
| 6 | cpan | LROCHER | Win32-GUI-DIBitmap | 0.13 | Win32-GUI-DIBitmap-0.13.zip | 1070995846 |
$ logstash -e 'input { stdin { } } output { stdout {} }'
Settings: Default pipeline workers: 4
Pipeline main started
> Hello, World!
2016-10-17T18:20:29.927Z gwen.local Hello, World!
Pipeline main has been shutdown
stopping pipeline {:id=>"main"}