Skip to content

Instantly share code, notes, and snippets.

View mped-oticon's full-sized avatar

Mark Ruvald Pedersen mped-oticon

  • Oticon
  • Denmark, Copenhagen
View GitHub Profile
@mped-oticon
mped-oticon / bash_parallel.source
Created August 21, 2023 11:55
Classic Fork-join parallelism in BASH, blocking and nestable
# Classic Fork-join parallelism. bash_parallel's can be nested arbitrarily
# Silent by default; set BASH_PARALLEL_VERBOSE=1 for verbose output on stderr
function bash_parallel
{
function bash_parallel_echo
{
if [[ $BASH_PARALLEL_VERBOSE == 1 ]] ; then
echo "$@" 1>&2
fi
}
@mped-oticon
mped-oticon / Output
Created August 10, 2023 09:53
git: byte-trunc utf-8 line
eisbaw in kbnuxcsfw-mped in git on  mped_bugfix_lockfile_maxname [?] via 🐍 v2.7.18
❯ nix-shell --run 'gcc mped_adhoc_test.c && ./a.out' -p gettext -p tcl -p expat -p curl -p openssl -p zlib
: is truncated to 0 bytes of hello world
: is truncated to 0 bytes of 😀💩👍🏽
: is truncated to 0 bytes of ∮∮∮ ∑∫∫ √−1
: is truncated to 0 bytes of السلام عليكم
: is truncated to 0 bytes of नमस्ते
: is truncated to 0 bytes of A̷͎̝͕͑͛̓Ȃ̵͙͊̄͘ạ̸̫͖͔͂̔̕ā̶͖͖͐̈́̔
: is truncated to 0 bytes of 𠜎𠜱𠝹𠱓
: is truncated to 0 bytes of A‍️‍♂️️
@mped-oticon
mped-oticon / inject.cocci
Created August 8, 2023 13:14
Semantic patch to instrument C code, used in debian_foreign
@remove_traces@
@@
(
- MYTRACE(...);
|
- MYTRACE_CASE(...);
|
- MYTRACE_ELSE_ENTER(...);
|
- MYTRACE_ELSE_LEAVE(...);
@mped-oticon
mped-oticon / bash_transcript.txt
Created June 14, 2023 21:45
justfile as a script, self-contained by Nix
eisbaw in kbnuxcsfw-mped in /scratch/fast_copy via ❄️ impure (shell)
❯ ./justfile
Available recipes:
help # Display the available commands
foo # This does FOO stuff
eisbaw in kbnuxcsfw-mped in /scratch/fast_copy via ❄️ impure (shell)
❯ ./justfile foo
echo bar
bar
@mped-oticon
mped-oticon / configuration_snippet.nix
Created May 4, 2023 11:22
DYMO LabelWriter 450 on NixOS
# Enable CUPS to print documents
services.printing.enable = true;
+ services.printing.drivers = [ pkgs.gutenprint pkgs.hplip pkgs.cups-dymo ];
# List available printers: lpstat -l -e
+ hardware.printers.ensurePrinters = [
+ {
+ description = "lw450";
+ name = "lw450";
@mped-oticon
mped-oticon / hafas_id_table_wip.txt
Created July 25, 2022 21:19
HAFAS id notes WIP
#VN#1#ST#1658481984#PI#0#ZI#25701#TA#14#DA#240722#1S#8600714#1T#1147#LS#8600659#LT#1300#PU#86#RT#1#CA#006#ZE#C#ZB# C#PC#4#FR#8600714#FT#1147#TO#8600659#TT#1300#
VN 1 # Version?
ST 1658481984 # UNIX time. Dep or arrival?
PI 0
ZI 25701
TA 14
DA 240722
1S 8600714 # Location ID. Of start or end?
1T 1147