This file contains hidden or 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 mymap (&@) { | |
my ( $code, @list ) = @_; | |
my @res ; | |
for my $item ( @list ) { | |
$_ = $item; | |
push @res, $code->(); | |
} | |
return @res; | |
} |
This file contains hidden or 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
: SEQ ( nx ny -- nx ... ny ) | |
SWAP OVER OVER | |
< IF | |
BEGIN | |
OVER 1 + SWAP | |
OVER OVER >= | |
UNTIL | |
DROP | |
ELSE | |
BEGIN |
This file contains hidden or 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
#!/bin/sh | |
export HOME=/home/ytnobody | |
cd $HOME/work/myapp | |
. ~/perl5/perlbrew/etc/bashrc | |
perlbrew use perl-5.12.3 | |
export PERL5OPT="-Ilib" | |
exec carton exec "$@" |
This file contains hidden or 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
MYAPP_HOME=/home/ytnobody/work/myapp | |
SETLOCK=/usr/local/bin/setlock | |
LOGGER=/bin/logger | |
*/5 * * * * $SETLOCK /tmp/myapp.lock $MYAPP_HOME/bin/env $MYAPP/bin/getter | $LOGGER -t MYAPP |
This file contains hidden or 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 Imager; | |
my $i = Imager->new; | |
$i->read(file => 'meat.png'); | |
my $img = $i->to_rgb8; | |
$img->write(file => 'lite-meat.png'); |
This file contains hidden or 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 Parallel::ForkManager; | |
my $pm = Parallel::ForkManager->new(4); | |
for my $i ( 1 .. 30 ) { | |
my $sleep = int(rand(5)+3); | |
my $pid = $pm->start and next; | |
printf "PID:%s NUM:%s START sleep %s\n", $pid, $i, $sleep; |
This file contains hidden or 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/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use AnyEvent; | |
use AnyEvent::Twitter::Stream; | |
use AnyEvent::IRC::Client; | |
use Encode; | |
use Net::Twitter::Lite; | |
use Text::MeCab; |
This file contains hidden or 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/env lua | |
i = 20 | |
f = loadstring("if (i == 20) then return true else return nil end") | |
if ( f() ) then | |
print "ok" | |
else | |
print "ng" | |
end |
This file contains hidden or 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
#!/bin/sh | |
# | |
# rbenvsetup http://is.gd/rbenvsetup | |
# Tue May 28 11:03:00 JST 2013 v0.01 by ytnobody | |
# | |
RBENV_REPO=git://github.com/sstephenson/rbenv.git | |
RBENV_ROOT=$HOME/.rbenv | |
PROF_FILE=$HOME/.bash_profile |
This file contains hidden or 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/env bash | |
# shellcheck disable=SC2016 | |
# | |
# plenvsetup http://is.gd/plenvsetup | |
# Tue Jan 7 17:29:22 JST 2020 v0.06 by ytnobody | |
# | |
set -e | |
die () { |