View gstreamer-video-test.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.18; | |
use warnings; | |
use Glib qw(TRUE FALSE); | |
use Glib::Object::Introspection; | |
my $loop = Glib::MainLoop->new; | |
map { Glib::Object::Introspection->setup(basename => $_, version => '1.0', package => 'GStreamer') } qw'Gst GstBase'; | |
GStreamer::init([$0, @ARGV]); | |
say 'GStreamer ', join '.', GStreamer::version(); |
View fold_wrap.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; use warnings; | |
use feature 'say'; | |
use List::MoreUtils 'minmax'; | |
# usage: fold_wrap.pl 10 4 8 | |
say "wrap: ".wrap(@ARGV); | |
say "fold: ".fold(@ARGV); | |
sub wrap { | |
use integer; |
View test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpanm U Plack | |
# later | |
plackup -MU -MPlack::Builder -e 'builder { enable "Auth::Basic", authenticator => sub {$_[0].$_[1] eq 'a0b0'}; Plack::App::Directory->new->to_app }' |
View xlsx2mysql.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; use warnings; | |
use feature qw'say state'; | |
use File::Basename 'basename'; | |
use Spreadsheet::XLSX; | |
use DBI; | |
use IO::Prompt::Tiny 'prompt'; | |
use Getopt::Std 'getopt'; | |
getopt(my $arg = 'hPupfd', my $opts = {qw(h localhost u root)}); # host user pass file ?db_name | |
my ($host, $port, $user, $pass, $file, $db_name) = @$opts{split'',$arg}; |
View http_tiny_gzip.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use utf8; use strict; use warnings; use feature qw'say state'; | |
use URI; use HTTP::Tiny; | |
use IO::Uncompress::Gunzip 'gunzip'; | |
say fetch('http://some-site'); | |
sub fetch { | |
my $response = (state $ua = HTTP::Tiny->new(default_headers => {qw'Accept-Encoding gzip'}))->get(URI->new($_[0])); | |
say join '', ($response->{success} ? 'ok' : 'fail'), ': ', $_[0]; | |
$response->{success} && length $response->{content} |
View gtk3-filechoose.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; use warnings; | |
use Gtk3 -init; | |
my $dialog = Gtk3::FileChooserDialog->new( | |
'Select files..', Gtk3::Window->new('toplevel'), | |
qw'open OK ok'); | |
$dialog->set_select_multiple(Gtk3::true); | |
$dialog->signal_connect( response => sub { |
View s3sync.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# s3sync: 1-way synchronization of your files with S3 storage with auto minify *.css and *.js files and gzip text/* content | |
use Modern::Perl; | |
use Amazon::S3; | |
use Path::Class (); | |
use IO::Compress::Gzip qw(gzip $GzipError); | |
use File::MMagic; | |
use JavaScript::Minifier::XS; |
View example.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub wrap { | |
my ($self, $data) = @_; | |
return $self->engine->process($self->path.'/layout.html', { | |
'//head' => { | |
'title' => $data->{title}, | |
'./script[last()-1]' => @{$data->{js}}?[map { './@src' => '/js/'.$_.'.js' }, @{$data->{js}}]:undef, | |
'./link[last()]' => @{$data->{js}}?[map { './@href' => '/css/'.$_.'.css'}, @{$data->{css}}]:undef, | |
'./script[last()]' => $data->{jscode}?sub { $_ =~ s/\/\*code\*\//$data->{jscode}/; \$_ }:undef, | |
}, | |
'//body' => { |
View chat.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="application/x-javascript"> | |
WEB_SOCKET_SWF_LOCATION = 'WebSocketMain.swf'; | |
</script> | |
<script src="socket.io.min.js"></script> | |
<script src="//yandex.st/prototype/1.7.0.0/prototype.min.js"></script> | |
<script type="application/x-javascript"> | |
Event.observe(document, 'dom:loaded', function (){ | |
var socket = new io.Socket(window.location.hostname, { |
View gist:1536353
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#perl | |
use v5.12; | |
use CDF; | |
use Data::Dumper qw(Dumper); | |
my ($id, @out); | |
CDF::CDFopen($ARGV[0], \$id); | |
CDF::CDFinquire($id, refstd([( undef, [], (undef) x 5 )])); pout(); |
OlderNewer