Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
@dolmen
dolmen / AA.pm
Created Feb 14, 2014
Exemple de méthode vraiment privée en Perl.
View AA.pm
use strict;
use warnings;
no warnings 'experimental';
use feature 'lexical_subs'; # my sub, experimental in perl 5.18
use feature 'say';
use utf8;
package AA;
sub new
@dolmen
dolmen / README.md
Last active Aug 29, 2015
Check if your Perl 5 stack is vulnerable to the OpenSSL heartbleed bug
View README.md

Check if your Perl stack is vulnerable to the OpenSSL « heartbleed » bug.

curl -s https://gist.githubusercontent.com/dolmen/10096474/raw/ssl-heartbleed-check.pl | perl
@dolmen
dolmen / post-checkout.pl
Created Apr 8, 2014
My git post-checkout hook
View post-checkout.pl
#!/usr/bin/perl
# mkdir -p ~/.gittemplate/hooks
# git config --global init.templatedir ~/.gittemplate
#
# Save this script as ~/.gittemplate/hooks/post-checkout
use 5.010;
use strict;
use warnings;
@dolmen
dolmen / corelist-filter.pl
Last active Aug 29, 2015
A filter for a list of Perl 5 modules, that will remove pure core modules such as 'integer'
View corelist-filter.pl
#!perl
use 5.010;
use strict;
use warnings;
use Module::CoreList 2.99;
use Getopt::Long;
my $verbose; # --verbose
@dolmen
dolmen / core-only-list.pl
Last active Aug 29, 2015
List of core-only modules
View core-only-list.pl
#!perl
# List of core-only modules: modules that are bundled with perl, and not on CPAN
# Unfortunately this list includes modules that are distributed on CPAN but have
# been hidden from PAUSE indexing.
# Example: Locale::Codes::Country_Codes
use 5.010;
use strict;
use warnings;
@dolmen
dolmen / dzil-toolchain-upgrade.sh
Last active Aug 29, 2015
Dist::Zilla toolchain upgrade
View dzil-toolchain-upgrade.sh
# Just once
test -f ~/bin/traceuse-modules.sed || echo 's/^ *[1-9][0-9]*\. *\([A-Za-z][^ ,/]*\) .*$/\1/p' > ~/bin/traceuse-modules.sed
# Use Devel::TraceUse to find modules used in the Dist::Zilla build
perl -d:TraceUse=output:x.txt -S dzil listdeps > /dev/null
# Extract modules list from Devel::TraceUse output and upgrade them
sed -n -f ~/bin/traceuse-modules.sed x.txt | sort | xargs cpan
@dolmen
dolmen / codingame-onboarding-start.pl
Created Sep 3, 2014
Basic code for the Codingame tuto
View codingame-onboarding-start.pl
use strict; use warnings; use 5.014;
select(STDOUT); $| = 1; # DO NOT REMOVE
# The code below will read all the game information for you.
# On each game turn, information will be available on the standard input, you will be sent:
# -> the total number of visible enemies
# -> for each enemy, its name and distance from you
# The system will wait for you to write an enemy name on the standard output.
# Once you have designated a target:
# -> the cannon will shoot
@dolmen
dolmen / alien-SVN-Debian.pl
Last active Aug 29, 2015
An installer that will link the system SVN::* modules to the current perl dirs
View alien-SVN-Debian.pl
#!/usr/bin/env perl
# System perl on Debian is threaded.
# Here is how to try to build a compatible one with plenv:
# plenv install 5.20.1 --as=5.20.1-thr -Dusethread
use Config;
use File::Path 'make_path';
my $errors = 0;
@dolmen
dolmen / Point10.java
Last active Aug 29, 2015
An immutable Point class to limits bounds to [-10, 10]
View Point10.java
// A point class must be immutable
class Point
{
public final double x;
public final double y;
public Point(double x, double y)
{
this.x = x;
@dolmen
dolmen / Test-Builder-compatibility-break.pl
Last active Aug 29, 2015
Test::Builder compatibility breakage
View Test-Builder-compatibility-break.pl
use strict;
use warnings;
use Test::More tests => 1;
use B;
my $x = \(my $y);
# In newer TB, the reference to note's argument is kept and breaks the following test
note $x;
is(B::svref_2object($x)->REFCNT, 2, "refcnt=2");
You can’t perform that action at this time.