Skip to content

Instantly share code, notes, and snippets.

View delphinus's full-sized avatar

JINNOUCHI Yasushi delphinus

View GitHub Profile
@delphinus
delphinus / gist:1734688
Created February 4, 2012 02:46
post string to Pasterfire.com
curl.exe --data-urlencode "clipboard=%Data%" -d "email=EMAIL_ADDRESS" -d "pwd=PASSWORD" "https://pastefire.com/set.php"
@delphinus
delphinus / mk_color.vim
Created February 4, 2012 08:29
make full color num to 88 color mode
" functions {{{
" returns an approximate grey index for the given grey level
fun <SID>grey_number(x)
if &t_Co == 88
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
use DateTime;
my $d = DateTime->new(
year => 2012,
month => 1,
day => 1,
time_zone => 'Asia/Tokyo',
);
print $d->clone->add(months => 3)->ymd . "\n";
print $d->clone->add(days => 90)->ymd . "\n";
use Time::Piece;
#my $d = localtime(time);
my $d = Time::Piece->strptime('2012-01-01', '%Y-%m-%d');
print $d->add_months(3)->ymd . "\n";
"-----------------------------------------------------------------------------
" Gist
let g:gist_privates=1
let g:gist_privates=1
screen -URR -O -c .screenrc
:set fdc=5 fdm=indent foldlevel=99 foldlevelstart=99
@delphinus
delphinus / gist:1976513
Created March 5, 2012 04:00
calculate mean & median
sub mean {
my @values = @_;
return sum(@values) / @values;
}
sub median {
my @sorted = sort { $a <=> $b } @_;
return @sorted % 2
? $sorted[int(@sorted / 2)]
: mean(@sorted[@sorted / 2 - 1, @sorted / 2]);
@delphinus
delphinus / gist:2005038
Created March 9, 2012 04:25
make compilcated random nums
srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`);