Skip to content

Instantly share code, notes, and snippets.

@thundergnat
thundergnat / unicode-properties
Created February 15, 2023 12:06
Full names for Unicode properties
my %properties = L => '(Letter)',
Lu => '(Letter, uppercase)',
Ll => '(Letter, lowercase)',
Lt => '(Letter, titlecase)',
Lm => '(Letter, modifier)',
Lo => '(Letter, other)',
M => '(Mark)',
Mn => '(Mark, nonspacing)',
Mc => '(Mark, spacing combining)',
Me => '(Mark, enclosing)',
sub ValidateLineType($ln) returns Int {
my $lt = $ln.split( /<ws>/, :skip-empty )[0];
($lt ~~ 0..5) ?? $lt.Int !! -1
}
my @fp = # open "data.ldr", :r;
#Meh, just load some data into the array
"0 0\n1 0\n2 0\n3 0\n4 0\n5 0\n6 0\n12 5\n3 3\n4\t\t3\n".lines;
sub UNIVER {
[
<1.1> => 'a',
<2.0> => 'ẛ',
<2.1> => '€',
<3.0> => 'ϟ',
<3.1> => 'ϴ',
<3.2> => '⁇',
<4.0> => 'ȡ',
<4.1> => 'ℼ',
$ zef install cro --verbose
===> Searching for: cro
===> Found: cro:ver<0.8.7> [via Zef::Repository::Ecosystems<cpan>]
===> Fetching [OK]: cro:ver<0.8.7> to /home/steve/.zef/tmp/1644762957.83630.5499.876015230394/cro-0.8.7.tar.gz
===> Extraction [OK]: cro to /home/steve/.zef/tmp/cro-0.8.7.tar.gz
===> Testing: cro:ver<0.8.7>
[cro] t/tools-crofile.t ...... ok
[cro] t/tools-link-editor.t .. ok
[cro] t/tools-runner.t ....... Dubious, test returned 1
[cro] No subtests run
@thundergnat
thundergnat / julia-set.raku
Last active August 14, 2021 11:22
Concurrency / variable locking woes
>$ time raku julia-set.raku
MoarVM oops: MVM_str_hash_fetch_nocheck called with a stale hashtable pointer
MoarVM oops: MVM_str_hash_fetch_nocheck called with a stale hashtable pointer
at julia-set.raku:26 (<ephemeral file>:hsv2rgb)
at julia-set.raku:26 (<ephemeral file>:hsv2rgb)
from julia-set.raku:17 (<ephemeral file>:)
from julia-set.raku:16 (<ephemeral file>:)
from julia-set.raku:17 (<ephemeral file>:)
from SETTING::src/core.c/Rakudo/Internals/HyperRaceSharedImpl.pm6:63 (/home/steve/.perl6/share/perl6/runtime/CORE.c.setting.moarvm:process-batch)
from julia-set.raku:16 (<ephemeral file>:)
my %*SUB-MAIN-OPTS = :named-anywhere;
use Text::Sorensen :sorensen;
use JSON::Fast;
my $hashfile = './Sorenson-chars.json';
unit sub MAIN ( $phrase, $head = 10, :$ge = 0.5 );
my %out;
@thundergnat
thundergnat / Toggle_syntax_highlighting.user.js
Last active August 30, 2022 00:24
Toggle syntax highlighting on Rosettacode task entries
// ==UserScript==
// @name Toggle syntax highlighting
// @namespace http://tampermonkey.net/
// @version 0.2
// @description toggle syntax highlighting on task pages
// @author thundergnat
// @match *://rosettacode.org/wiki/*
// @icon https://www.google.com/s2/favicons?domain=rosettacode.org
// @grant none
@thundergnat
thundergnat / Language_links.user.js
Last active January 23, 2023 01:07
Tampermonkey / Greasemonkey script to add Language link parameters to Rosettacode Language Category pages
multi expand-tree ( Bag $tree ) {
bag(bag(bag()) (+) $tree) (+)
[(+)] (
$tree.keys ==> map {
$^a.&expand-tree.map: * (+) ( $tree (-) bag($^a) )
}
);
}
multi expand-trees ( Bag $trees ) {
use NativeCall;
use SDL2::Raw;
my int ($w, $h) = 320, 240;
SDL_Init(VIDEO);
my SDL_Window $window = SDL_CreateWindow(
"White Noise - Raku",
SDL_WINDOWPOS_CENTERED_MASK, SDL_WINDOWPOS_CENTERED_MASK,