Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hacking

Bart Wiegmans bdw

💭
Hacking
View GitHub Profile
View geojson-to-postgis.py
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
import operator
import psycopg2
import psycopg2.extras
import io
import json
import sys
import logging
View spesh-542.txt
This file has been truncated, but you can view the full file.
Specialization of '' (cuid: 1)
Before:
Spesh of '' (cuid: 1, file: ./t/spec/S32-str/sprintf-b.t:188)
BB 0 (0x7fe9ddcb3818):
line: 188 (pc 0)
Instructions:
no_op
@bdw
bdw / ListUtil.pm
Created Aug 27, 2019
Reimplementation of List::Util for running on perl 5.10
View ListUtil.pm
#!/usr/bin/env perl
package ListUtil;
# Reimplementation of List::Util for running on perl 5.10
use strict;
use warnings;
use Exporter 'import';
@ListUtil::EXPORT_OK = qw(pairgrep pairmap pairkeys pairvalues);
sub pairgrep(&@) {
my $code = shift;
@bdw
bdw / cmp_n.nqp
Created Jul 7, 2019
floating points nqp
View cmp_n.nqp
#!/usr/bin/env nqp
if (0.125 < 0.126) {
nqp::say("OK");
} else {
nqp::die("NOT OK");
}
@bdw
bdw / genius.py
Last active Jun 18, 2019
Genius - a roman daemon. This is a python context manager which tries to ensure it is the only process identified by a pidfile.
View genius.py
import os
import fcntl
import signal
import time
import contextlib
class Genius(object):
'''
A genius is basically a roman daemon. It differs from python-daemon
in the following ways:
View MVM_VECTOR_CONTAINS.patch
From b0cf91cf7bc32fc20f73f4abc463d952c86983a3 Mon Sep 17 00:00:00 2001
From: Bart Wiegmans <bartwiegmans@gmail.com>
Date: Fri, 17 May 2019 12:45:13 +0200
Subject: [PATCH] [Vector] Implement MVM_VECTOR_CONTAINS with memmem
This should be more flexible (arbitrary sized items) and hopefully
faster because memmem is fairly optimized. And allows the use as an
expression.
---
build/Makefile.in | 1 +
View linking.md

Linking Perl 6 Compiler and Programs

Description

Currently, starting a Perl 6 programs means loading a shell script that starts a MoarVM, that loads the rakudo compiler (as bytecode) and libraries (also bytecode), before loading the user script and compiling that. This adds significantly to the startup time of perl6

View trunc.nqp
#!/usr/bin/env nqp
sub foo(int64 $x) {
my int16 $y := $x;
my int64 $z := $y;
return $z;
}
my int $i := 0;
while ($i++ < 100_000) {
View shift.nqp
#!/usr/bin/env nqp
sub shifter(int $x, int $y) {
nqp::abs_i(nqp::bitshiftl_i($x, $y));
}
my int $i := 0;
while ($i++ < 1_000_000) {
my $x := shifter(10,3);
if (shifter(10,3) != 80) {
@bdw
bdw / spesh-log.txt
Created Oct 5, 2018
INLINE_END ends up on prepargs
View spesh-log.txt
Specialization of 'repository-version' (cuid: 15072)
Before:
Spesh of 'repository-version' (cuid: 15072, file: SETTING::src/core/CompUnit/Repository/Installation.pm6:129)
BB 0 (0x7fffec65a388):
line: 129 (pc 0)
Instructions:
no_op
Successors: 1