Skip to content

Instantly share code, notes, and snippets.

View issm's full-sized avatar

issm issm

View GitHub Profile
@issm
issm / a.pl
Created September 8, 2010 13:18 — forked from clairvy/a.pl
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib qq($FindBin::Bin/lib);
use Data::Dumper;
# preapare table
@issm
issm / test.pl
Created September 8, 2010 15:13
#!/usr/bin/env perl
use strict;
use warnings;
use lib '/path/to/DBIx-Skinny-0.0718/lib'; # 0.0718 のあるパス
package My::DB;
use DBIx::Skinny setup => +{
dsn => 'dbi:mysql:test',
username => '',
@issm
issm / test.pl
Created September 9, 2010 03:17
#!/usr/bin/env perl
use strict;
use warnings;
# mysql -h localhost test
# create table hoge (id int(10) auto_increment, hoge char(16), fuga char(16), t int(10), primary key (id));
# insert into hoge (hoge, fuga, t) values ('aaa', 'xxx', UNIX_TIMESTAMP()), ('bbb', 'yyy', UNIX_TIMESTAMP()), ('ccc', 'zzz', UNIX_TIMESTAMP());
package My::DB;
use DBIx::Skinny setup => +{
use strict;
use warnings;
package My::DB;
# default setting
my $setup = +{
dsn => 'dbi:mysql:test',
username => 'user',
password => 'passwd',
# ref: Web::Scraper;
package Hoya::Test::These;
use strict;
use warnings;
use Carp;
use Try::Tiny;
sub import {
@issm
issm / gist:830712
Created February 17, 2011 01:10
generates EAN13/Code39 barcode easily.
plackup -s Starman --port 5000 -MGD::Barcode -MGD::Image -MPlack::Request -e 'my $app = sub { my $q = Plack::Request->new(shift)->query_parameters(); my ($c,$m,$r,$h,$nt) = split(/:/,$q->get("q")||""); my $bc = GD::Barcode->new($m||"EAN13",$c) or return [500,["Content-Type"=>"text/plain"],[$GD::Barcode::errStr]]; my ($i0,$i1) = ($bc->plot(Height=>$h,NoText=>$nt)); my ($w0,$h0) = $i0->getBounds(); my ($w1,$h1) = (int($w0*($r||1)),int($h0*($r||1))); $i1 = GD::Image->new($w1,$h1); $i1->copyResized($i0,0,0,0,0,$w1,$h1,$w0,$h0); return [200,["Content-Type"=>"image/png"],[$i1->png]]; }'
@issm
issm / gist:1011750
Created June 7, 2011 05:49
diff of "formula" of groonga in Homebrew
--- a 2011-06-07 14:45:12.000000000 +0900
+++ b 2011-06-07 14:45:32.000000000 +0900
@@ -1,9 +1,9 @@
require 'formula'
class Groonga < Formula
- url 'http://groonga.org/files/groonga/groonga-1.0.6.tar.gz'
+ url 'http://packages.groonga.org/source/groonga/groonga-1.2.2.tar.gz'
homepage 'http://groonga.org/'
- md5 'a278e72801a68acf374cbc309d73ba34'
@issm
issm / gist:1015079
Created June 8, 2011 18:57
ad-hoc patch to build mroonga on Mac OSX
--- groonga-storage-engine-0.6/ha_mroonga.cc 2011-05-29 20:11:11.000000000 +0900
+++ groonga-storage-engine-0.6-fix/ha_mroonga.cc 2011-06-09 03:20:08.000000000 +0900
@@ -93,7 +93,7 @@
if (mrn_logfile_opened) {
pthread_mutex_lock(&mrn_log_mutex);
fprintf(mrn_logfile, "%s|%c|%08x|%s\n", time,
- *(slev + level), (uint)pthread_self(), msg);
+ *(slev + level), (uint)(unsigned long int)pthread_self(), msg);
fflush(mrn_logfile);
pthread_mutex_unlock(&mrn_log_mutex);
--- /home/issm/perl5/perlbrew/etc/bashrc.orig 2011-07-01 01:38:42.980862704 +0900
+++ /home/issm/perl5/perlbrew/etc/bashrc 2011-07-01 01:38:56.810831503 +0900
@@ -3,7 +3,7 @@
fi
if [[ -f $PERLBREW_HOME/init ]]; then
- . $PERLBREW_HOME/init
+ \. $PERLBREW_HOME/init
fi
@issm
issm / gist:1071501
Last active September 26, 2015 08:48
function hs () {
local n_hist_default=1000000
local colors; colors=(32 33 34 35 36 31)
local n_hist=${1#-}
if [ ! "$1" = "" -a ! $n_hist = $1 ]; then
shift
if [ $n_hist -gt 0 ]; then
else