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
| #!/bin/rc | |
| # "The hell was *that*?" | |
| # A substitute for mashing the error message into a search engine: | |
| # · Reads /dev/text by default; see -i and -a. | |
| # · Tells the clanker to explain what the hell is going on. | |
| # · The clanker attempts to explain what the hell is going on. | |
| # · Dumps some stuff in /tmp to debug and also to integrate with other | |
| # local tools. |
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
| #!/bin/rc | |
| # This script was written entirely out of perversity: | |
| # it is LLM code-completion for acme under Plan 9. | |
| # It will attempt to fill in a chunk of code under the cursor, | |
| # in acme | |
| # under Plan 9 | |
| # using only tools available in Plan 9 | |
| # to talk to ollama. | |
| # I have mixed the sacred and the profane. | |
| # You just put it in the tag in the acme window, and then you |
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
| echo '++++[->++++<]>[-<+++++>>+++++++>++<<]<------.>>+++++.--.+.>.<[-<+>>>+<<]>[--<++>>-<]>---.+++++++++++++.+.<<<.>>>-------.---.<<<--.>.>>+++.-------.++.++[->+<<+>]>++++++.<<.<<.>[-<<->>]<<++++.[>>>--<<<-]>>>+.' | \ | |
| sed -E 's/(.)/\1\n/g' | \ | |
| awk 'BEGIN{print "BEGIN{p=0;"}END{print "}"}/\./{print "printf \"%c\",a[p]"}/\+/{print "a[p]++"}/-/{print "a[p]--"}/</{print "p--"}/>/{print "p++"}/\[/{print "while(a[p]){"}/\]/{print "}"}' | \ | |
| awk -f /dev/fd/0 |
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/awk | |
| # Friend on fedi just showed me https://github.com/xonixx/makesure , I speculated that you could do make in ~10 lines of awk. | |
| # You basically can: 9 lines, not counting comments. | |
| # File format is a subset of make, "targ1: dep1 ... depN\n\tline1\n\tline2\ntarg2: ..." | |
| # Invocation is different: `make.awk 'targ=whatever' Makefileish` | |
| # To run it on Plan 9, change /usr/bin/awk to /bin/awk and "stat -c %Y" to just "mtime" | |
| # I have not executed this code; it is a stunt-hack. I just thought it would be funny. | |
| BEGIN{if(!length(targ))targ="all"} | |
| /^\t/{if(length(cur) < 1) { print "no targ"; exit }; ts[cur] = ts[cur] "&&" $0; next } | |
| !NF{cur=""; next} |
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
| conky.config = { | |
| border_width = 1, | |
| cpu_avg_samples = 2, | |
| default_color = 'white', | |
| minimum_width = 5, | |
| default_graph_width = 200, | |
| default_graph_height = 40, | |
| default_gauge_width = 200, | |
| alignment = 'top_left', | |
| background = false, |
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
| I turned this gist into a "real" repository. It is here: http://github.com/pete/cats . | |
| Here, placed side-by-side for comparison, are GNU's implementation of | |
| cat, Plan 9's implementation, Busybox's implementation, and NetBSD's | |
| implementation, Seventh Edition Unix (1979), and 4.3BSD. | |
| For good measure (and because I suppose I am now committed to collecting | |
| cats) also included are Second Edition Unix (in assembly) and Inferno's | |
| implementation (in Limbo) for good measure. |
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 ruby | |
| # "Fork and Forget" | |
| # Don't wait if you don't have to: A mini-tutorial about concurrency | |
| # mechanisms in Ruby and basic Unix systems programming, and how you can use | |
| # them to avoid waiting. | |
| # | |
| # I have heard that people are occasionally unfamiliar with this strategy. | |
| # It's a common idiom, regardless of language, and it is also essentially built | |
| # into Erlang (and Termite Scheme, etc.). | |
| # |
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
| I was waiting for a Linux kernel to build. It seems to take | |
| longer to configure a new kernel every time, like the number | |
| of options have been steadily increasing. I thought I might | |
| be hallucinating, you know? Maybe I have just gotten | |
| impatient and the bloat wasn't that bad. Or maybe it is | |
| the case that the options have gotten horribly numerous and | |
| increasingly arcane. In any case, I did this: | |
| for m in $list_of_linux_machines_here; do | |
| ssh $m wc -l '/usr/src/linux-*/.config' |
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 ruby | |
| # Hey, wanna see something fun? | |
| # | |
| # My disk broke. Thinking quickly, I decided to harness the unlimited power of | |
| # User Error, and partially wreck my backup. | |
| # | |
| # Don't ask. | |
| # | |
| # md0 had most of the data. But the filesystem and partition table were | |
| # wrecked, and some unknown amount of data had been exchanged between it and |
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
| Experiments in revision control: Curry recipe. | |
| My personal recipe for Japanese curry, which has mutated over the years and is | |
| now open-source thanks to github, hot damn. Some of the ingredients are not | |
| very Japanese, but curry came to Japan from England which got it from India to | |
| begin with, so whatever. | |
| 1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too. | |
| Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon | |
| works surprisingly well. Chicken will work, technically, but if you must, |
NewerOlder