Skip to content

Instantly share code, notes, and snippets.

View ziguzagu's full-sized avatar

Hiroshi Sakai ziguzagu

View GitHub Profile
@ziguzagu
ziguzagu / uri_vs_uri-split.pl
Last active February 10, 2016 06:10
URI vs URI::Split (v1.60)
#!/usr/bin/env perl
use strict;
use warnings; use utf8;
use Benchmark qw(cmpthese);
use URI;
use URI::Split qw(uri_split);
my $uri = 'https://www.example.com/path/2016/10/my-awesome-photo.jpg?utm=aaa#anchor1';
cmpthese(200000, {
#!/usr/bin/env perl
use strict;
use Mojo::JSON qw(j);
use Storable qw(thaw nfreeze);
use Data::Dumper;
use Symbol qw(delete_package);
my $json = j('{"boolean":true,"string":"this is string"}');
warn Dumper($json);
my $bin = nfreeze($json);
#!/usr/bin/env perl
use strict;
use warnings;
package Foo {
sub new { bless {}, shift }
sub AUTOLOAD {
my $self = shift;
our $AUTOLOAD;
# name : perl
# --
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Getopt::Long qw( :config posix_default no_ignore_case gnu_compat );
use Pod::Usage;
@ziguzagu
ziguzagu / mt-cpanfile
Last active December 16, 2015 00:19
cpanfile for movabletype
## -*- mode: perl; coding: utf-8 -*-
requires 'DBI';
requires 'DBD::mysql';
requires 'Digest::SHA';
requires 'Plack';
requires 'CGI::PSGI';
requires 'CGI::Parse::PSGI';
requires 'CGI::Compile';
requires 'XMLRPC::Transport::HTTP::Plack';
requires 'HTML::Entities';
➜ cpandiff Cache::Memcached::Fast 0.19 0.20 | head -40
diff -Npurw Cache-Memcached-Fast-0.19/Changes Cache-Memcached-Fast-0.20/Changes
--- Cache-Memcached-Fast-0.19/Changes 2010-04-24 04:35:28.000000000 -0700
+++ Cache-Memcached-Fast-0.20/Changes 2013-04-03 10:35:44.000000000 -0700
@@ -1,6 +1,24 @@
Revision history for Perl extension Cache::Memcached::Fast.
+0.20 2013-04-03
+ - finally fix magic.t failure. Magic handling introduced in
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
my ($pkg, $from, $to) = @ARGV;
$pkg =~ s/::/-/g;
my $content = get("http://search.cpan.org/diff/${pkg}-${from}-${pkg}-${to}.-w.diff")
or die "oops. no content. try again!\n";
use strict;
use warnings;
use FindBin;
use MogileFS::Client;
use Plack::Builder;
use Plack::MIME;
my $mog;
@ziguzagu
ziguzagu / DBUtil.py.diff
Last active December 12, 2015 12:18
https://github.com/ganglia/gmond_python_modules の mysqld モジュール MySQL 5.5 対応パッチ
diff --git a/mysqld/python_modules/DBUtil.py b/mysqld/python_modules/DBUtil.py
index 21b7522..db2bfbb 100644
--- a/mysqld/python_modules/DBUtil.py
+++ b/mysqld/python_modules/DBUtil.py
@@ -86,7 +86,7 @@ def parse_innodb_status(innodb_status_raw):
innodb_status['active_transactions']
for line in innodb_status_raw:
- istatus = line.split()
+ istatus = line.replace(',', '').split()
;;;; -*- mode: lisp-interaction; syntax: elisp; coding: iso-2022-7bit -*-
(provide 'init-color)
(require 'font-lock)
(global-font-lock-mode t)
;; basics
(set-face-foreground 'default "white")
(set-face-background 'default "black")
(set-cursor-color "green")