Skip to content

Instantly share code, notes, and snippets.

# Here's what needs to happen:
# 1) Add a compiler switch to tcc that lets me specify the output filename for
# serialized extended symbol tables. DONE
# 2) Add a compiler switch to tcc that lets me specify the output filename for
# a list of global identifier names. DONE
# 3) Compile a text file with the headers below, saving the serialized extended
# symbol table and the list of global identifiers
# 4) Create an XS file with a BOOT section that loads the serialized table,
# adds the global identifiers, and pushes the extended symbol table onto the
# Perl exsymtab collection.
cc -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/dcmertens/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux-thread-multi/CORE -Wl,-E -fstack-protector -L/usr/local/lib -L/home/dcmertens/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux-thread-multi/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc func_test_402YB8e5.c -o func_test_9EF5Maod
/tmp/ccXxD47M.o: In function `S_croak_memory_wrap':
func_test_402YB8e5.c:(.text+0x5): undefined reference to `PL_memory_wrap'
func_test_402YB8e5.c:(.text+0x14): undefined reference to `Perl_croak_nocontext'
collect2: error: ld returned 1 exit status
@run4flat
run4flat / study-prima-mouse-interaction.pl
Created November 16, 2011 20:05
Basic Callbacks with Prima
use strict;
use warnings;
use Prima qw(Application);
my $wDisplay = Prima::MainWindow-> create(
text => 'Mouse Test',
onMouseDown => sub {
print "onMouseDown got args [", join('], [', @_), "]\n";
},
onMouseMove => sub {
@run4flat
run4flat / gist:1623396
Created January 16, 2012 22:34
PDL::Transform::Color - Convert between color systems
=head1 NAME
PDL::Transform::Color - Convert between color systems
=head1 SYNOPSIS
# load an image (in this case the cartographic demo)
use PDL::Transform::Cartography; $rgb = earth_image();
# convert the image to CMYK
@run4flat
run4flat / piddlebot.pl
Created January 22, 2012 04:47
piddlebot!
#!/usr/bin/perl
# This is a simple IRC bot that just rot13 encrypts public messages.
# It responds to "rot13 <text to encrypt>".
use warnings;
use strict;
use POE;
use POE::Component::IRC::State;
use constant CHANNEL => '#pdl';
# Load the current piddlebot functions:
@run4flat
run4flat / piddlebot.pl
Created January 22, 2012 23:34
Original Piddlebot.pl
#!/usr/bin/perl
use strict;
use warnings;
use POE;
use POE::Component::IRC::State;
use POE::Component::IRC::Plugin::AutoJoin;
#use POE::Component::IRC::Plugin::BotTraffic;
use POE::Component::IRC::Plugin::BotCommand;
use POE::Component::IRC::Plugin::CycleEmpty;
@run4flat
run4flat / example.pl
Created January 24, 2012 03:44
PDL+TCC
use strict;
use warnings;
use PDL;
use Inline Pdlpp => Config =>
INC => "-I$ENV{HOME}/include",
LIBS => "-L$ENV{HOME}/lib -ltcc",
;
use Inline 'Pdlpp';
@run4flat
run4flat / PDL_Checker.pm
Created January 24, 2012 14:21
Testing POD
use strict;
use warnings;
our @all_listings;
my %actions;
# Import the names of the main listings and run the command or print help
sub PDL_Checker::import {
shift;
@all_listings = @_;
@run4flat
run4flat / matrix-viewer.pl
Created January 31, 2012 20:23
save a matrix
use strict;
use warnings;
use PDL;
my $data;
BEGIN {
$data = rfits('20kV_1p45A_14deg_Fourier.fit');
}
use PDL::Graphics::Prima::Simple [$data->dims];
@run4flat
run4flat / fit-data.pl
Created February 2, 2012 20:24
Simple Perl script to generate and fit noisy linear data
use strict;
use warnings;
=pod
To run, say something like this:
perl fit-data.pl data.dat
where data.dat is the file created using make-data.pl