Skip to content

Instantly share code, notes, and snippets.

@mberends
mberends / macros.markdown
Last active April 14, 2019 18:34
MoarVM C language macros

##MoarVM source C language macros

Alphabetical list of all (over 700) C language macros defined in the src/ subtree of MoarVM (https://github.com/MoarVM/MoarVM). Generated by script included at the end.

Macros in .h files

####ATKEY(vm, hash, k) src/mast/nodes_moarvm.h:149 #define ATKEY(vm, hash, k) (MVM_repr_at_key_boxed(vm, hash, k))

@mberends
mberends / SVG test for Darkenwood
Last active December 16, 2015 11:28
Static SVG proof of concept for images to be dynamically generated by Perl 5.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- SVG definition http://www.w3.org/TR/2011/REC-SVG11-20110816/ -->
<svg width="600" height="450" viewBox="0 0 12 9" preserveAspectRatio="xMaxYMax" version="1.1" xmlns="http://www.w3.org/2000/svg">
<title>Cave 1</title>
<desc>The first cave has three rooms</desc>
<defs>
<pattern id="Grey6" width="0.125" height="0.125" patternUnits="userSpaceOnUse" viewBox="0 0 8 8">
<rect x="0" y="0" width="8" height="8" fill="white" />
@mberends
mberends / gtk-webbrowser.pl
Created October 2, 2011 21:29
almost complete web browser for Niecza Perl 6
# gtk-webbrowser.pl - based on the Gtk C# example
# see Gnome Libraries, Gtk, HTML class at http://docs.go-mono.com/
# needs libgtkhtml3.16-cil on Debian or Ubuntu
# Names that occur multiple times. Names used only once appear inline.
constant $GTK = "gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f";
constant $GTKHTML = "gtkhtml-sharp, Version=3.16.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f";
constant $SYSTEM = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
constant Application = CLR::("Gtk.Application,$GTK");
@mberends
mberends / gtk-matchboxes.pl
Created September 25, 2011 17:52
GUI solution for masak's matchboxes puzzle on Niecza Perl 6
# gtk-matchboxes.pl - GUI solution for http://irclog.perlgeek.de/perl6/2011-09-23#i_4469618
constant $GTK = "gtk-sharp,Version=2.12.0.0,Culture=neutral,PublicKeyToken=35e10195dab3c99f";
constant $GDK = "gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f";
constant $GLIB = "glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f";
# use 'gacutil -l' to look up similar module details
constant Application = CLR::("Gtk.Application,$GTK");
constant GdkCairoHelper = CLR::("Gdk.CairoHelper,$GDK");
constant GLibTimeout = CLR::("GLib.Timeout,$GLIB");
constant GtkDrawingArea = CLR::("Gtk.DrawingArea,$GTK");
@mberends
mberends / gtk-calc.pl
Created September 11, 2011 23:44
half working GUI Calc program for Niecza
# Niecza Calculator
# GTK Sharp docs: http://docs.go-mono.com/monodoc.ashx?link=N%3aGtk
# To run: mono run/Niecza.exe examples/gtk1.pl
# Warning: unfinished, sometimes crashes
constant $GTK = "gtk-sharp,Version=2.12.0.0,Culture=neutral,PublicKeyToken=35e10195dab3c99f";
constant Application = CLR::("Gtk.Application,$GTK");
constant Window = CLR::("Gtk.Window,$GTK");
constant Entry = CLR::("Gtk.Entry,$GTK");
$ cat testenv.pm6
print 'Test existence of %*ENV<PERL6LIB>: ';
print %*ENV.exists('PERL6LIB');
say " OK, still alive";
$ rakudo testenv.pm6
Test existence of %*ENV<PERL6LIB>: Bool::True OK, still alive
martin@meee:~/fakedbi$ cat postgresqlclient.p6
# postgresql test example 1 translated from C to Perl 6
# See http://www.postgresql.org/docs/9.0/static/libpq-example.html
# and more comments below.
use NativeCall; # from project 'zavolaj'
# -------- foreign function definitions in alphabetical order ----------
sub PQclear( OpaquePointer $res )
#!/usr/bin/perl -w
# process-monitor.pl
# Only tested on Linux - uses the /proc virtual filesystem
use Getopt::Long;
use Time::HiRes;
my (
$sampling_interval, # interval for sampling process info (0.1sec)
$display_interval # interval for displaying results (off)
=== KEEP ===
* 0-based versus 1-based
** Month, day-of-month, day-of-week, day-of-year are all 1-based.
** All time-based ones are 0-based.
** Year is neither.
* Constructor:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>S28-special-names.pod</title>
<style type="text/css">
h1 { font-family: Sans; }
table { }
td { vertical-align: top; }
td#pod { border-style: solid; width: 100%; }
td#pod > pre { font-size: 8pt; }