Skip to content

Instantly share code, notes, and snippets.

View dolmen's full-sized avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
use v5.10;
use strict;
use warnings;
BEGIN {
package Macro::Simple;
use Carp;
use Parse::Keyword {};
sub import
@maddingue
maddingue / SerializerUtils.pm
Last active August 29, 2015 14:13
types coercion
sub coerce_types {
my $struct = shift;
my $ref = ref $struct;
croak "can only work with references" unless $ref;
if ($ref eq "ARRAY") {
for my $i (0..$#{$struct}) {
next unless defined $struct->[$i];
@kentfredric
kentfredric / winrar.pl
Created January 23, 2015 17:15
Abuse CPANM by hacking its library loading process to allow injecting arbitrary code.
#!/usr/bin/env perl
# FILENAME: unfatten.pl
# CREATED: 01/24/15 04:55:06 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Attempt to extract files from a codes fatpacked library.
use strict;
use 5.010001;
use warnings;
{
#!/usr/bin/env perl
use strict;
use warnings;
sub dep(@) { Dep->new( name => @_ ) }
## Archive::Tar ------
dep 'GSAR/Archive-Tar-0.071.tar.gz' => provides => { 'Archive::Tar' => '0.071', };
dep 'SRZ/Archive-Tar-0.22.tar.gz' => provides => { 'Archive::Tar' => '0.22', };
@rjbs
rjbs / can-ver.pl
Created November 17, 2009 22:20
abusing prototype() for API version
# if ($obj->can('foo')) { ... }
# if ($obj->can('foo', $api_version)) { ... }
# if ($obj->can('foo', $api_version, $minor_version)) { ... }
use strict;
use Number::Nary qw(n_codec);
my $major = 10;
load_plugin qw(
Completion
CompletionDriver::INC
CompletionDriver::LexEnv
CompletionDriver::Keywords
CompletionDriver::Methods
ReadLineHistory
);
@dolmen
dolmen / utf8-console.cmd
Created October 22, 2010 09:50
Console Win32 en UTF-8
@mode con cp select=65001
@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{
@a2800276
a2800276 / nodecamp.eu-talks-2011.md
Created June 14, 2011 04:37 — forked from fhemberger/nodecamp.eu-talks-2011.md
A collection of talks and presentations held at nodecamp.eu 2011
@bzerangue
bzerangue / twitter-button.xsl
Created August 31, 2011 17:21
[XSLT] Twitter Button XSL Utility
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Twitter Button: XSL Utility
Created by Zerangue, Brian on 2011-08-31.
Copyright (c) 2011 Brian Zerangue. All rights reserved.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">