Skip to content

Instantly share code, notes, and snippets.

View rurban's full-sized avatar

Reini Urban rurban

View GitHub Profile
@rurban
rurban / Jit-nt-simple.xs
Created March 14, 2010 08:54
perl5 x86 runloop jitting
/* Jit-nt.xs: no threads, no JUMPTABLE
*
* Copyright (C) 2010 by Reini Urban
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
* http://gist.github.com/331867
*/
/***********************************************************************
* connect.c -- Make socket connection using SOCKS4/5 and HTTP tunnel.
*
* Copyright (c) 2000-2006 Shun-ichi Goto
* Copyright (c) 2002, J. Grant (English Corrections)
* Copyright (c) 2010, Reini Urban (added realm to http_auth basic)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
#!/usr/bin/perl
use strict;
# See https://rt.cpan.org/Public/Bug/Display.html?id=57341
use GCC::TranslationUnit;
use Getopt::Long;
my ($cc, $inc, $code, $file, $type);
GetOptions( "cc=s" => \$cc,
"I=s" => \$inc,
"code=s" => \$code,
#! perl
package
optimizer::and_not;
=head1 DESCRIPTION
[perl #76438] peephole optimiser could prune more dead code
optimize (AND CONST->NO) to null if no GVSV/PADSV, else (DOR $x) or do some SvGETMAGIC.
package Test::TAP::Unify;
use strict;
use warnings;
use Carp;
our $VERSION = '0.01';
1;
__END__
@rurban
rurban / opt_methods_bench.pl
Created July 29, 2011 06:06
benchmark github.com/rurban/perl/commit/7a305aae0b335 opt_methods
use Benchmark;
sub Class::method {
my(@args) = @_;
die unless @args == 2
}
BEGIN {
@FooClass::ISA = qw(Class);
@MyClass::ISA = qw(FooClass);
@rurban
rurban / snpp.pl
Created August 17, 2011 11:15
Sub::Name::PP
#!/usr/bin/perl
# Sub::Name::PP without B. pack/unpack with our structs is enough
# See http://www.perlmonks.org/?node_id=379428
# and https://github.com/ribasushi/snpp/blob/subname_pp/lib/Sub/Name/PP.pm
use Devel::Peek;
$DEBUG = 1;
$sub = sub {$word};
Dump($sub) if $DEBUG;
@rurban
rurban / asan_addr2dis
Created November 24, 2011 19:41
asan_addr2dis
#!/usr/bin/perl
#
# Symbolize AddressSanitizer stacktraces via objdump -Sd.
# Expands the 0 frame srcline and for subsequent frames only the function name.
#
# OPTIONS:
# -l prints all lines, without -l only the expanded stacktraces.
# -f<n> disassembles the first n stackframes, not only the first
# -f0 disassembles all stackframes
# Copyright 2011 Reini Urban, BSD License
@rurban
rurban / gist:1481424
Created December 15, 2011 15:10
briandfoy/perldoc
d8055e1:
Use of uninitialized value in concatenation (.) or string at /usr/local/lib/perl5/5.14.2/Pod/Perldoc/ToMan.pm line 50.
_remove_nroff_footer is still a stub!
at /usr/local/lib/perl5/5.14.2/Pod/Perldoc.pm line 1328
6b901fe: (3.15_13)
$ perldoc -f wait
Error while formatting with Pod::Perldoc::ToMan:
Can't locate object method "_is_mandoc" via package "Pod::Perldoc::ToMan" at /usr/local/lib/perl5/5.14.2/Pod/Perldoc/ToMan.pm line 199.
@rurban
rurban / gist:3238864
Created August 2, 2012 17:17
require-nul.pl
require-nul.pl:
#!perl
my $plugin = "Test::More\0Evil::Package";
{
no strict 'refs';
@{$plugin."::ISA"} = ('Test::More');
}
package main;