Skip to content

Instantly share code, notes, and snippets.

@eiro
eiro / gist:2987642
Created June 25, 2012 09:36
debut de validateur MARC::MIR
#! /usr/bin/perl
use Modern::Perl;
use JSON;
use Plack::Request;
use MARC::MIR;
use Test::Builder;
sub run_test {
my ( $mir ) = @_;
my $tb = Test::Builder->create;
@eiro
eiro / gist:1322199
Created October 28, 2011 12:54
inotify based autoreload for perl dancer
#! /usr/bin/env zsh
dancer_pid=
dancer () {
perl bin/dancer &
dancer_pid=$!
}
kill_dancer () { kill $dancer_pid }
restart_dancer () { kill_dancer && dancer }
changes_in_source_tree () {inotifywait -r -e modify --exclude ".*swp" . }
@eiro
eiro / gist:1277764
Created October 11, 2011 10:18
compojure + hiccup "hello world"
; vim sw=4
(ns compas.core
(:use compojure.core)
(:use hiccup.core)
(:require
[compojure.route :as route]
[compojure.handler :as handler]
)
)
@eiro
eiro / gist:1270527
Created October 7, 2011 15:27
.mbsynrc sample
# default values for all boxes
Sync Full
Expunge Both
# root of the local storage
MaildirStore local
Path ~/local/mail/
Trash Trash
# remote box
@eiro
eiro / gist:1264624
Created October 5, 2011 14:55
elasticsearch result ?
use ElasticSearch;
my $es = ElasticSearch->new(qw/ servers localhost:9200 /) or die;
$es->error_trace(1);
say YAML::Dump $es->search( qw/ index log type log query /,
{ text => {qw/ id bb303ab02dded9577a87db0e82649f77cf4f51c8c8198860cc29b64321336c92:2011-10-04:16/}
}
);
__END__
@eiro
eiro / gist:1261608
Created October 4, 2011 13:10
my gitconfig
> cat ~/.gitconfig
[alias]
oll = log --oneline
ba = branch -a
cm = checkout master
cs = checkout stage
cd = checkout devel
co = checkout
s = status -s
ci = commit
@eiro
eiro / gist:1261597
Created October 4, 2011 13:05
my zsh prompt
precmd () {
local gitwhere=$( stfu2 git symbolic-ref HEAD)
[[ -n $gitwhere ]] || gitwhere=$( stfu2 git describe)
[[ -n $gitwhere ]] && {
local modif=`git s|wc -l`
[[ $modif = 0 ]] && modif="" || modif="($modif files modified)"
gitwhere="[${gitwhere##*/}$modif]"
}
export PS1="[%T] %n@%M%b:%d $gitwhere"$'\n'"> "
}
@eiro
eiro / gist:1107121
Created July 26, 2011 16:06
cpan install dans une branche
set -e
cd /rtgi/modules/Local-Lib
export PERL_MB_OPT="--install_base $PWD"
export PERL_MM_OPT="INSTALL_BASE=$PWD"
git checkout perl-5.12.3-devel
git pull
candidate="$1"
@eiro
eiro / gist:658253
Created November 1, 2010 14:32
parsing DNS zone with regexp::grammars
#! /usr/bin/perl
use Modern::Perl;
use YAML;
# Net::Grammars::Digzone;
# possible bugs: no empty line available
# http://en.wikipedia.org/wiki/List_of_DNS_record_types
my $parse_dig_zone = do {
use Regexp::Grammars;
qr{
@eiro
eiro / gist:658244
Created November 1, 2010 14:26
example of Ouesh usage
use Ouesh;
# predefined classic commands (as plugin ?)
authorize_rsync_server;
# run command if returns true
binary cat => sub {
not ( '/etc/shadow' ~~ $BINARGS)
};