Skip to content

Instantly share code, notes, and snippets.

View emanuele6's full-sized avatar
๐Ÿ„

Emanuele Torre emanuele6

๐Ÿ„
  • Provincia di Varese, Italy
  • 14:32 (UTC +02:00)
View GitHub Profile
@emanuele6
emanuele6 / awk1.awk
Created December 5, 2021 17:27
aoc day 5 2021
function hvcoo(p, f, hv) {
if (hv == "h")
return p SUBSEP f
return f SUBSEP p
}
BEGIN { FS = ",| -> " }
$1 == $3 { hv = "v"; f = $1; a = $2; b = $4 }
$2 == $4 { hv = "h"; f = $2; a = $1; b = $3 }
#!/bin/bash -
get_rect() {
local target
target=$(bspc query -N -n "$1.floating") || return
bspc subscribe node_geometry | while IFS=' ' read -r _ _ _ wid rect; do
if (( wid == target )); then
printf '%s\n' "$rect"
break
fi
@emanuele6
emanuele6 / actually_playable_zork
Last active May 13, 2022 02:28
A simple tcl/expect script that gives DELETE key support to jzip (z-machine emulator) so that I can sanely play zork on my laptop. (my laptop's BACKSPACE key does not work)
#!/bin/sh --
# \
exec tclsh -encoding ascii "$0" "$@"
# usage: actually_playable_zork [zork_command] [save_file]
package require Expect
if {$::argc >= 1} {
set zork [lindex $::argv 0]