This file contains hidden or 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
| my $conc = (%*ENV<CONC> // 4).Int; | |
| my $mb = (%*ENV<MB> // 4).Int; | |
| my $rounds = (%*ENV<ROUNDS> // 60).Int; | |
| my $chars = $mb * 1024 * 1024; | |
| my $blob = ('a' x $chars).encode('utf8'); | |
| say "decoding {$blob.elems} bytes x $rounds on $conc threads, $conc allocator threads"; | |
| my @w; |
This file contains hidden or 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
| #include <algorithm> | |
| #include <print> | |
| #include <span> | |
| #include <string_view> | |
| // Separate this out into a function to make it easier to test. | |
| bool is_palindrome(std::string_view s) { | |
| // Avoids manual pointer manipulation, still does n/2 checks. | |
| // Note: integer division floors, but this is correct since given an | |
| // odd-length string, middle char will always equal itself. |
This file contains hidden or 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
| .global _main | |
| .align 2 | |
| .data | |
| guess_msg: .ascii "INPUT A NUMBER (0-9):" | |
| guess_len = . - guess_msg | |
| equal_msg: .ascii "BOTH NUMBERS ARE EQUAL!\n" | |
| equal_len = . - equal_msg | |
| lower_msg: .ascii "FIRST NUMBER IS HIGHER!\n" | |
| lower_len = . - lower_msg |
This file contains hidden or 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
| .global _main | |
| .align 2 | |
| .data | |
| msg: .ascii "Hello, World!\n" ; non-null terminated 'string' | |
| len = . - msg ; Calculate string length (14 bytes) | |
| .text | |
| _main: | |
| mov x0, #1 ; File descriptor 1 = stdout |
This file contains hidden or 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
| .global _main | |
| .align 2 | |
| .data | |
| random_path: .asciz "/dev/urandom" | |
| guess_msg: .ascii "GUESS A NUMBER (0-9): " | |
| guess_len = . - guess_msg | |
| equal_msg: .ascii "CORRECT - YOU WIN\n" | |
| equal_len = . - equal_msg | |
| lower_msg: .ascii "TRY AGAIN (HINT: LOWER): " |
This file contains hidden or 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 python3 | |
| """ | |
| slow_smoke.py – cross-platform “smoking throttle” timer | |
| • Chimes every N minutes between 08:00 and 01:00 (local time) | |
| • Shows Last smoke / Next smoke / Interval / Time-to-next, with red→green | |
| • Press any key to register a smoke | |
| • Adds +1 min to the interval each new day, persisting state in ~/.slow_smoke_state.json | |
| """ | |
| import datetime as dt | |
| import json, os, sys, time, pathlib, signal, shutil, platform, select |