Skip to content

Instantly share code, notes, and snippets.

*~
/deps/
/local/
/perl
/prove
/plackup
/Makefile.setupenv
/cin
/config/perl/libs.txt
@wakaba
wakaba / Makefile
Created August 6, 2012 06:57
Maintaining GitHub repository mirrors
# ------ Configuration files ------
config-all: config-cron
config-cron:
mkdir -p local/config/cron.d
cd config/cron.d.src && find -type f | \
xargs -l1 -i% -- sh -c "cat % | sed 's/@@ROOT@@/$(subst /,\\/,$(abspath .))/g' > ../../local/config/cron.d/%"
# ------ Sync operations ------
use Test::More tests => 2;
push @Class1::ISA, qw(Base1 Base2);
sub Base2::hoge { 0 }
{
local *Base1::hoge = sub { 1 };
ok +Class1->hoge;
}

NAME

screenlist - List of screens

INSTALL

Add following lines to ~/.bashrc:

perl ~/screenlist/add.pl
alias s="perl ~/screenlist/run.pl"
@wakaba
wakaba / bin-hoge.pl
Created June 25, 2012 02:02
Perl script template
#!/usr/bin/perl
use strict;
BEGIN {
my $file_name = __FILE__;
$file_name =~ s{[^/\\]+$}{};
$file_name ||= '.';
$file_name .= '/../config/perl/libs.txt';
open my $file, '<', $file_name or die "$0: $file_name: $!";
unshift @INC, split /:/, scalar <$file>;
}
require Parse::Netstat;
my $timer; $timer = AnyEvent->timer(
interval => 0.6,
cb => sub {
my $netstat;
AnyEvent::Util::run_cmd(
'LANG=C netstat --inet --inet6 -n -p -l',
'>' => \$netstat,
'2>' => \(my $dummy),
# -*- Makefile -*-
CARTON = local/carton/bin/carton
CARTON_LIB = local/carton/lib/perl5
PERL = perl
CPANM = $(PERL) local/carton/cpanm
CPANM_ = $(CPANM) --notest --verbose -l local/carton --reinstall
CPANM_PATH = local/carton
PERL_PATH = local/dummy/path/to/perl
SSH = ssh