This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BB 14 (0x7f030419cdf8): | |
line: 283 (pc 188) | |
Instructions: | |
[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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"foobarbaz".comb.Array.splice(3,1,"X").join.say; | |
# 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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
$p | |
} | |
+ class ListenSocket is Supply { | |
+ has Promise $.socket-host; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
# inspired by https://narimiran.github.io/2018/05/10/python-numpy-nim.html | |
use nqp; | |
constant N = 10_000; | |
constant sigma = 0.1e0; | |
constant f = (2 / N).Num; | |
constant mu = 0.001e0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
killall -SIGSTOP i3 | |
urxvt -geometry 100x2 -name "flub" -e tmux -L CNTR& | |
sleep 1 | |
ID=0x`xwininfo -root -tree | grep "flub" | sed -e 's/.*0x//' -e 's/ .*//'` | |
SCRNWDT=`xrandr | grep \* | sed -e 's/x.*//' -e 's/^ *//'` | |
xprop -id $ID -f _NET_WM_STRUT_PARTIAL 32cccccccccccc -set _NET_WM_STRUT_PARTIAL "0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, $SCRNWDT" | |
xprop -id $ID -f _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_DOCK | |
tmux -L CNTR send-keys 'countup-bin $COLUMNS 5' "Enter" | |
tmux -L CNTR set-option -g status off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define trace_spesh_optimize | |
dont-repeat | |
python | |
import tempfile | |
import os | |
import gdb | |
spesh_trace_target_folder = tempfile.mkdtemp("", "moar-spesh-trace") | |
spesh_trace_target_file = os.path.join(spesh_trace_target_folder, "speshdump.txt") | |
os.system("git init " + spesh_trace_target_folder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar g{ | |
token garble {<[2]>}; | |
token alpha1 {<[2]>}; | |
token beta { <[q]> }; | |
token delta {<+garble +beta>}; | |
token delta1 {<+garble>}; | |
token delta2 {<+alpha1 +beta>} | |
} | |
say so "2" ~~ /<g::delta1>/; # OK | |
say so "2" ~~ /<g::delta2>/; # OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Test; | |
sub combinations_with_replacement(@iterable, $r) { | |
gather { | |
cwr(@iterable, [], $r); | |
} | |
} | |
sub cwr(@iterable, @state, $r) { | |
my $place = @state.elems; |