Skip to content

Instantly share code, notes, and snippets.

View dolmen's full-sized avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
@dolmen
dolmen / PodPOMWeb.pm
Created April 27, 2011 14:55
A simple wrapper for Pod::POM::Web for a shorter command-line interface
use strict;
use warnings;
package PodPOMWeb;
use Pod::POM::Web;
sub import
{
my @caller = caller;
if ("$caller[0]/$caller[1]" eq 'main/-e') {
@dolmen
dolmen / Shell-AutoLoad.pm
Created May 4, 2011 17:00
Shell::AutoLoad : similar to Shell, but without captures
use strict;
use warnings;
package Shell::AutoLoad;
use Carp;
sub import
{
my $pkg = caller;
@dolmen
dolmen / git-patching-workflow.dot
Created May 9, 2011 05:25
My patching workflow with Git (GraphViz)
// My Git worflow, when patching external projects
// Copyright (C) 2011 Olivier Mengué. All rights reserved.
// dot -Tpng -o git-patching-workflow.png git-patching-workflow.dot
digraph {
find_repo [ label="Find an interesting project on GitHub (or another Git repository)"];
use [ label="Use, test..." ];
bug_idea [ label="Find a bug or idea for a feature" ];
@dolmen
dolmen / GoogleBing.psgi
Created May 13, 2011 08:16
Discovering PSGI: A proof of concept of a proxy that switches Google and Bing
# vim:set ft=perl:
use strict;
use warnings;
# plackup --port 8079 -s Twiggy -a GoogleBingProxy.psgi
# http_proxy=http://0.0.0.0:8079/ curl -i http://www.google.fr/
# Les lignes suivantes ne sont pas néccessaires, mais ça permet de
# spécifier plus clairement les dépendances pour ceux qui voudraient faire
@dolmen
dolmen / concat.pl
Created June 30, 2011 08:58
Concat lazy lists
sub concat ($$)
{
my ($i, $j) = @_;
my $g;
$g = sub {
my ($i, @v) = $i->();
if (defined $i) {
($g, @v);
} else {
($j, @v);
@dolmen
dolmen / errno.cmd
Created June 30, 2011 10:11
Perl: list Errno constants
perl -MErrno -E "say join qq<\n>, sort grep /^E[A-Z]+$/, @Errno::EXPORT_OK" | more
@dolmen
dolmen / takeWhile.pl
Created July 2, 2011 14:37
takeWhile, version tail-head
sub takeWhile (&$) {
my ( $cond, $l ) = @_;
my $m;
$m = sub {
1 < ( ( $l, my @v ) = $l->() ) or return ($l);
return $cond->() ? ( $m, @v ) : ( sub { ( $l, @v ) } ) for @v;
};
}
@dolmen
dolmen / context.pl
Created July 2, 2011 15:56
Perl return contexts
use 5.010;
use strict;
use warnings;
sub ctx1
{
return (3);
}
@dolmen
dolmen / apple-store.pl
Created July 20, 2011 09:58
Apple Store check, using AnyEvent
#!/usr/bin/perl
# AnyEvent version of https://gist.github.com/1094658
use 5.010;
use strict;
use warnings;
use AnyEvent;
use AnyEvent::HTTP;
@dolmen
dolmen / report.txt
Created August 6, 2011 19:44
Bug Module::Build when installing Snowball-Norvegian-1.2-zrr10
Running make for A/AS/ASKSH/Snowball-Norwegian-1.2.tar.gz
Prepending /home/dolmen/.local/share/.cpan/build/Test-Compile-0.13-9VVA_G/blib/arch /home/dolmen/.local/share/.cpan/build/Test-Compile-0.13-9VVA_G/blib/lib to PERL5LIB for 'get'
Fetching with LWP:
http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/cpan/authors/id/A/AS/ASKSH/Snowball-Norwegian-1.2.tar.gz
Checksum for /home/dolmen/.local/share/.cpan/sources/authors/id/A/AS/ASKSH/Snowball-Norwegian-1.2.tar.gz ok
Snowball-Norwegian-1.2/
Snowball-Norwegian-1.2/bin/
Snowball-Norwegian-1.2/bin/.exists
Snowball-Norwegian-1.2/bin/stemmer-no.pl
Snowball-Norwegian-1.2/Build.PL