Skip to content

Instantly share code, notes, and snippets.


  • Karlsruhe
Block or report user

Report or block timo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
timo / Perl6-Github-Linkify.js
Last active Jun 27, 2019
linkify filename/line-number entries in github issues in a couple different formats
View Perl6-Github-Linkify.js
// ==UserScript==
// @name Perl6-Github-Linkify
// @namespace
// @version 0.3.3
// @description Turns paths to perl6 source (core setting, grammar, actions) and moarvm code to clickable links on github issue/PR pages as well as gists
// @author Timo 'timotimo' Paulssen
// @match*/*/issues/*
// @match*/*/pull/*
// @match*
// @grant none
timo / query
Created Dec 6, 2018 — forked from Whateverable/query
View query
my $l =; my %h; for 1..10 { my $p = start { sleep rand; $l.protect: { say "-- ", $p.WHERE; say %h.elems; %h{$p.WHERE}:delete; say %h.elems } }; say "+", $p.WHERE; %h{$p.WHERE} = $p; }; await %h.values; note %h.elems
timo / currently-working.sql
Last active Nov 8, 2018
can i make the update part of this query use a "with recursive" expression?
View currently-working.sql
-- for testing, completely reset highest_child_id columns
update calls set highest_child_id = NULL;
-- find rows where no other row has the row's id as its parent_id
-- those shall seed the progress with initial "highest child id"
-- values
with no_children as (select id from
(select as id, count( as childcount
from calls c
left join calls children on == children.parent_id
timo / HashyObject.p6
Created Sep 30, 2018
#perl6 use a hash as if it were an object
View HashyObject.p6
unit class HashyObject;
has %!storage;
submethod TWEAK(*%data) { %!storage = %data }
submethod FALLBACK($name, |c) is rw { %!storage{$name} };
method perl {
self.^name ~ ".new(" ~ %!*.perl).join(", ") ~ ")"
timo / gist:b01c70e2f7ce4a40eddc19517e3aee87
Created Sep 26, 2018
hilarious-looking compilation result of allomorphs.pm6 &parse_win
View gist:b01c70e2f7ce4a40eddc19517e3aee87
BB 14 (0x7f030419cdf8):
line: 283 (pc 188)
[Annotation: Logged (bytecode offset 188)]
sp_getlex_o r6(20), lex(idx=0,outers=0,newval)
[Annotation: INS Deopt One (idx 8 -> pc 196; line 283)]
[Annotation: INS Deopt One (idx 9 -> pc 202; line 283)]
sp_guardconc r6(4), r6(20), sslot(1), litui32(196)
[Annotation: Logged (bytecode offset 354)]
sp_getlex_o r9(25), lex(idx=0,outers=0,newval)
timo / mutator-tunnel-operator.p6
Last active Sep 17, 2018
A little operator that lets you mutate an object in a one-liner without needing to use the mutator's return value!
View mutator-tunnel-operator.p6
# Output: b
# Issue: splice returns what was cut out, not the result.
# Solution: Keep the array of characters around for later.
my @a = "foobarbaz".comb; @a.splice(3,1,"X"); @a.join.say;
# Output: fooXarbaz
# Don't want to introduce a local variable for this?
timo / pass-host-and-port-on-listen.patch
Created Jul 20, 2018
pass host and port to a "ListenSocket" in IO::Socket::Async
View pass-host-and-port-on-listen.patch
diff --git a/src/core/IO/Socket/Async.pm6 b/src/core/IO/Socket/Async.pm6
index 87dcf39a5..a86a9f08f 100644
--- a/src/core/IO/Socket/Async.pm6
+++ b/src/core/IO/Socket/Async.pm6
@@ -195,23 +195,32 @@ my class IO::Socket::Async {
+ class ListenSocket is Supply {
+ has Promise $.socket-host;
timo / shlomifish_euler_287.nqp
Created Jun 3, 2018
nqp and perl6 optimized versions of shlomi fish's (rindolf's) euler 287 solution.
View shlomifish_euler_287.nqp
#!/usr/bin/env perl6
# The Expat License
# Copyright (c) 2018, Shlomi Fish
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View gradientDescent.p6
#!/usr/bin/env perl6
# inspired by
use nqp;
constant N = 10_000;
constant sigma = 0.1e0;
constant f = (2 / N).Num;
constant mu = 0.001e0;
View result.txt
timo@schmand /tmp> perl6 --profile=heap testshellmem.p6 shell
Before shell call : 101.664 kb
html is 230457 chars
After shell call : 210.332 kb
After forced gc: 249.704 kb
html is 230457 chars
After shell call : 323.016 kb
After forced gc: 354.232 kb
html is 230457 chars
After shell call : 401.640 kb
You can’t perform that action at this time.