Skip to content

Instantly share code, notes, and snippets.

@2sh
2sh / kokanu.mjs
Created September 8, 2023 22:55
#!/usr/bin/env node
// pdf2svg Logography\ for\ Kokanu.pdf input/kokanu_%d.svg all
// node kokanu.mjs pre
// node kokanu.mjs post
import fs from 'fs/promises'
import fsx from 'fs'
import readline from 'readline'
@mutewinter
mutewinter / package.json
Created October 4, 2016 21:28
Use Jest with CoffeeScript
{
"jest": {
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node",
"coffee"
],
"preprocessorIgnorePatterns": [ ],
# this is my solution to GRAPH.
# it offers an interactive mode and some test cases
use v6;
class Graph {
has @!nodes;
has %!neighbour;
method connect($a, $b) {
# curl https://raw.githubusercontent.com/perl6/ecosystem/master/META.list | sort | perl -nlE 'say m{//.+?/([^/]+)}' | uniq -c | sort -bgr
49 jonathanstowe
28 retupmoca
25 supernovus
24 tony-o
22 zoffixznet
21 tadzik
15 azawawi
14 colomon

SOLVED -- see below

Here is the Perl code in question:

# basic init
my $myhtml = myhtml_create();
myhtml_init($myhtml, 0, 1, 0);

# init tree
#!/usr/bin/env perl6
use v6;
use Term::termios;
use NativeCall;
class FILE is repr('CPointer') {
sub fdopen(Int, Str) returns FILE is native { * }
method new(Int $fd) {
fdopen($fd, "r");
}

SOLVED

Trying to get this to bind properly with Perl6, and it's being difficult!

#include <stdlib.h>
#include <stdio.h>

int floatArrayTest(float **pa) {
  *pa = malloc(sizeof(float *) * 500);
@eddieh
eddieh / libevent-v-libuv.md
Last active March 7, 2024 20:33
libevent vs libuv

libevent vs libuv

Comparing libevent and libuv. My upfront biased: I want to like libevent. However, I want to objectively compare the two and make an informed decision.

What versions are we comparing?

  • libevent 2.0.22 (Stable) [2014-01-05]
  • libuv 1.8.0 (Stable) [2015-12-15]
@AlexDaniel
AlexDaniel / splits.md
Last active February 17, 2016 16:52
Array splits

Is there a cute Perl 6 way to take an array (say ‘a’..‘d’) and get all head/tail partitions of it (e.g. (<a>, <b c d>), (<a b>, <c d>), (<a b c>, <d>))?

Sure! Pick one:

my @a = a..e; say (@a[^$_, $_..*] for 1..^@a);
my @b = a..e; say (1..^@b).map: {@b[^$_, $_..*]};
my @c = a..e; say (@c.rotor($_, ∞, :partial) for 1..^@c);
my @z = a..e; say @z[0..*-2].keys.map: {@z[0..$_, $_^..*]}; # same as b
my @d = a..e; say (1..^@d).map: {@d.rotor: $_, ∞, :partial};