shithub: rc

Download patch

ref: 239a04ebb6f2378f56481ab761352be88c4318fb
parent: 822eb0ee2f7e54d668f0eb188a7c942efbaa0929
author: qwx <qwx@sciops.net>
date: Thu Jul 15 18:26:53 EDT 2021

move scripts to a bin/ subdir

--- a/2600
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/320;
-		b=$2/222;
-		c=int(b<a?b:a);
-		if(c*320 == $1 || c*222 == $2)
-			c--;
-		print "-dx", c*320+8, "-dy", c*222+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/2600 -a $*(3-) || games/2600 $*(3-)}
-if not
-	games/2600 -a $* || games/2600 $*
--- a/2mp3
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-play -o /fd/1 >[2]/dev/null |\
-	audio/pcmconv -i s16r1c1 -o S16r1c1 |\
-	audio/mp3enc -r -v -q 0
--- a/2opus
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/rc
-l=(--bitrate 128)
-if(~ $1 -l){
-	l=()
-	shift
-}
-play -o /fd/1 >[2]/dev/null |\
-	audio/opusenc --music --downmix-stereo $l
--- a/9grid
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/rc -e
-9fs tcp!chat.9p.zone!9990 /n/chat
-rm /srv/tcp!chat.9p.zone!9990
-# fukken quoting
-cat <<'!' >/tmp/grid.$pid
-#!/bin/rc
-window -r 0 0 656 516 -scroll chat -n qwx
-window -r 0 524 656 596 -scroll girc -g /n/chat/chat
-window -scroll 'echo cat /dev/wsys/1/text ''>>/tmp/chat''; echo ''{}>/dev/wsys/1/text''; rc'
-!
-chmod +x /tmp/grid.$pid
-rio -i /tmp/grid.$pid
-rm /tmp/grid.$pid
-unmount /n/chat
--- a/9grid.old
+++ /dev/null
@@ -1,22 +1,0 @@
-#!/bin/rc -e
-rfork n
-
-auth/factotum -n
-echo 'key proto=dp9ik user=glenda dom=grid !password=9gridchan' >/mnt/factotum/ctl
-srvtls tcp!registry.9gridchan.org!16675 gridreg /n/gridreg
-sed -n '/gridregistry/d;/tlssrv/{s/^/srvtls -c /;s/(is |mountpoint|service.*$)//g;s/pubregistry/gridpubreg/g;p;}' /n/gridreg/index | grep -v gridplumb | rc
-rm /srv/grid*
-#echo 'none
-#none' | `{sed -n 's/^([^ ]+).* is gridftp.*/ftpfs -\/ \1/p' /n/gridreg/index}
-#bind -c /n/ftp/incoming /n/gridftp
-
-unmount /mnt/plumb
-rio -k '
-window -scroll chat -n qwx
-window -scroll girc -g /n/chat/chat
-' || status=''
-
-for(i in /mnt/plumb /n/grid* /mnt/wiki /n/chat)
-	unmount $i
-#unmount /n/gridftp
-#unmount /n/ftp
--- a/aconv
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc
-parm=()
-if(~ $1 -l){
-	parm=(-l)
-	shift
-}
-pref=$1
-for(i in $*(2-)){
-	echo $i
-	2opus $parm <$i >`{echo $i | mfmt $pref opus}
-}
--- a/aconv2
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc
-parm=()
-if(~ $1 -l){
-	parm=(-l)
-	shift
-}
-pref=$1
-for(i in $*(2-)){
-	echo $i
-	audio/flacdec <$i | pcm2opus >`{echo $i | mfmt $pref opus}
-}
--- a/avgn
+++ /dev/null
@@ -1,31 +1,0 @@
-#!/bin/awk -f
-
-BEGIN {
-phrases=", goddamn it,\
-, what the hell,\
-, goddamn fuckshit,\
-, son of a fuck,\
-, Christ almighty,\
-, oh God,\
-, or whatever the fuck,\
-, fucking assballs, \
-! What the shit is this unholy fuckness?! Oh,\
-, what a great thing, huh,\
-, Jesus fucking Christ on a fucking pogo stick,\
-, you stupid fuck,\
-, fucking Christ,"
-
-len=split (phrases, phrase, /\n/)
-srand()
-}
-
-
-{ 
-  split ( $0, parts, /,/)
-  for (i=1; i<length(parts); i++) {
-    printf "%s", parts[i]
-    ind = 1+int(rand * 1000)%len;
-    printf "%s", phrase[ind]
-  }
-print parts[i]
-}
--- /dev/null
+++ b/bin/2600
@@ -1,0 +1,15 @@
+#!/bin/rc
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/320;
+		b=$2/222;
+		c=int(b<a?b:a);
+		if(c*320 == $1 || c*222 == $2)
+			c--;
+		print "-dx", c*320+8, "-dy", c*222+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/2600 -a $*(3-) || games/2600 $*(3-)}
+if not
+	games/2600 -a $* || games/2600 $*
--- /dev/null
+++ b/bin/2mp3
@@ -1,0 +1,4 @@
+#!/bin/rc
+play -o /fd/1 >[2]/dev/null |\
+	audio/pcmconv -i s16r1c1 -o S16r1c1 |\
+	audio/mp3enc -r -v -q 0
--- /dev/null
+++ b/bin/2opus
@@ -1,0 +1,8 @@
+#!/bin/rc
+l=(--bitrate 128)
+if(~ $1 -l){
+	l=()
+	shift
+}
+play -o /fd/1 >[2]/dev/null |\
+	audio/opusenc --music --downmix-stereo $l
--- /dev/null
+++ b/bin/9grid
@@ -1,0 +1,14 @@
+#!/bin/rc -e
+9fs tcp!chat.9p.zone!9990 /n/chat
+rm /srv/tcp!chat.9p.zone!9990
+# fukken quoting
+cat <<'!' >/tmp/grid.$pid
+#!/bin/rc
+window -r 0 0 656 516 -scroll chat -n qwx
+window -r 0 524 656 596 -scroll girc -g /n/chat/chat
+window -scroll 'echo cat /dev/wsys/1/text ''>>/tmp/chat''; echo ''{}>/dev/wsys/1/text''; rc'
+!
+chmod +x /tmp/grid.$pid
+rio -i /tmp/grid.$pid
+rm /tmp/grid.$pid
+unmount /n/chat
--- /dev/null
+++ b/bin/9grid.old
@@ -1,0 +1,22 @@
+#!/bin/rc -e
+rfork n
+
+auth/factotum -n
+echo 'key proto=dp9ik user=glenda dom=grid !password=9gridchan' >/mnt/factotum/ctl
+srvtls tcp!registry.9gridchan.org!16675 gridreg /n/gridreg
+sed -n '/gridregistry/d;/tlssrv/{s/^/srvtls -c /;s/(is |mountpoint|service.*$)//g;s/pubregistry/gridpubreg/g;p;}' /n/gridreg/index | grep -v gridplumb | rc
+rm /srv/grid*
+#echo 'none
+#none' | `{sed -n 's/^([^ ]+).* is gridftp.*/ftpfs -\/ \1/p' /n/gridreg/index}
+#bind -c /n/ftp/incoming /n/gridftp
+
+unmount /mnt/plumb
+rio -k '
+window -scroll chat -n qwx
+window -scroll girc -g /n/chat/chat
+' || status=''
+
+for(i in /mnt/plumb /n/grid* /mnt/wiki /n/chat)
+	unmount $i
+#unmount /n/gridftp
+#unmount /n/ftp
--- /dev/null
+++ b/bin/aconv
@@ -1,0 +1,11 @@
+#!/bin/rc
+parm=()
+if(~ $1 -l){
+	parm=(-l)
+	shift
+}
+pref=$1
+for(i in $*(2-)){
+	echo $i
+	2opus $parm <$i >`{echo $i | mfmt $pref opus}
+}
--- /dev/null
+++ b/bin/aconv2
@@ -1,0 +1,11 @@
+#!/bin/rc
+parm=()
+if(~ $1 -l){
+	parm=(-l)
+	shift
+}
+pref=$1
+for(i in $*(2-)){
+	echo $i
+	audio/flacdec <$i | pcm2opus >`{echo $i | mfmt $pref opus}
+}
--- /dev/null
+++ b/bin/avgn
@@ -1,0 +1,31 @@
+#!/bin/awk -f
+
+BEGIN {
+phrases=", goddamn it,\
+, what the hell,\
+, goddamn fuckshit,\
+, son of a fuck,\
+, Christ almighty,\
+, oh God,\
+, or whatever the fuck,\
+, fucking assballs, \
+! What the shit is this unholy fuckness?! Oh,\
+, what a great thing, huh,\
+, Jesus fucking Christ on a fucking pogo stick,\
+, you stupid fuck,\
+, fucking Christ,"
+
+len=split (phrases, phrase, /\n/)
+srand()
+}
+
+
+{ 
+  split ( $0, parts, /,/)
+  for (i=1; i<length(parts); i++) {
+    printf "%s", parts[i]
+    ind = 1+int(rand * 1000)%len;
+    printf "%s", phrase[ind]
+  }
+print parts[i]
+}
--- /dev/null
+++ b/bin/bindbins
@@ -1,0 +1,18 @@
+#!/bin/rc
+if(test -d $home/p/rc)
+	bind -a $home/p/rc/bin /bin
+if(test -d $home/p/rc2)
+	bind -a $home/p/rc2/bin /bin
+if(test -d $home/p/pico)
+	touch $home/bin/rc/pico && bind $home/p/pico/pico $home/bin/rc/pico
+if(test -d $home/p/sm2/bin)
+	bind -a $home/p/sm2/bin /bin
+if(test -d $home/p/notes/bin)
+	bind -a $home/p/notes/bin /bin
+if(test -d /sys/lib/go/amd64-1.15.2/bin)
+	bind -a /sys/lib/go/amd64-1.15.2/bin /bin
+if(test -f $home/p/rc/fn)
+	. $home/p/rc/fn
+
+#if(test -d $home/p/sm2/lib)
+#	bind -ac $home/p/sm2/lib /lib
--- /dev/null
+++ b/bin/br
@@ -1,0 +1,14 @@
+#!/bin/rc
+# SBLC_PWM_CTL2: bytes 15:0, range 0 (off) to v>>16 (full)
+
+if(! ~ $#* 1){
+	echo usage: $0 factor
+	exit 'usage'
+}
+v=`{seg -Lr igfxmmio 0x400000 0xc8254}
+if(~ $#v 0)
+	exit 'no such named segment'
+v=`{echo 'v='$v'; v & ~0xffff | ((v>>16) / '$1')' | pc -n}
+if(! ~ $#v 1)
+	exit 'invalid factor'
+seg -Lw igfxmmio 0x400000 0xc8254 $v
--- /dev/null
+++ b/bin/cex
@@ -1,0 +1,26 @@
+#!/bin/awk -f
+function q(){
+	o = 1 + int(rand() * 10 % 4)
+	a = 1 + int(rand() * (o==4 ? 1000 : 100))
+	b = 1 + int(rand() * 100)
+	r = o==1 ? a + b\
+		: o==2 ? a - b\
+		: o==3 ? a * b\
+		: a / b	# equality works... sometimes? rounding errors?
+	print a, op[o], b
+}
+BEGIN{
+	op[1] = "+"
+	op[2] = "-"
+	op[3] = "*"
+	op[4] = "/"
+	srand()
+	q()
+}
+{
+	if($1 != r){
+		print "NEIN NEIN NEIN!  " r
+		system("theo")
+	}
+	q()
+}
--- /dev/null
+++ b/bin/chat
@@ -1,0 +1,108 @@
+#!/bin/rc
+# minimal chat client for hubfs: chat [-n NICK] [-j CHANNEL] [chatsrv]
+# dd -bs `{du -n /n/chat/chat | sed 's/ .*//'} -skip 1 -if /n/chat/chat
+rfork enf
+
+fn helpmessage{
+	echo -------------------------
+	echo '/q to quit  |  /c to list channels  |  /h for help message'
+	echo '/n NICK to change nick  |  /j CHANNEL to change channels'
+	echo -------------------------
+}
+
+fn close{
+	#echo PART $name from $channel >>/n/$chatsrv/$channel
+	@{echo kill>/proc/$catkill/ctl}
+}
+
+fn shutdown{
+	close
+	exit
+}
+
+fn sighup{
+	shutdown
+}
+
+fn sigint{
+	shutdown
+}
+
+channel=chat
+chatsrv=chat
+while (~ $1 -*){
+	switch($1){
+	case -n
+		name = $2
+		shift 2
+	case -j
+		channel = $2
+		shift 2
+	case *
+		echo bad flag $1 '-n NICK -j CHANNEL'
+		shift
+	}
+}
+if(! ~ $1 '')
+	chatsrv=$1
+if(! test -e /n/$chatsrv/chat)
+	mount /srv/$chatsrv /n/$chatsrv
+if(! test -e /n/$chatsrv/chat){
+	echo 'no chat service named $chatsrv found' >[1=2]
+	exit no.chat
+}
+
+echo '		-- hubchat 0.2 --'
+helpmessage
+sleep 2
+while(~ $#name 0){
+	echo 'please enter a chat name:'
+	name=`{read}
+}
+#echo JOIN $name to $channel >>/n/$chatsrv/$channel
+#grep -bv '^BurnZeZ :  ' /n/$chatsrv/$channel &
+cat /n/$chatsrv/$channel &
+catkill=$apid
+
+while(talk=`{read}){
+	switch($talk(1)){
+	case /q
+		shutdown
+	case /n
+		if(! ~ $talk(2) ''){
+			echo nick $name ' -> ' $talk(2) >>/n/$chatsrv/$channel
+			name=$talk(2)
+		}
+		if not
+			echo 'you need to provide a nick for /n NICK'
+	case /j
+		if (~ $talk(2) '')
+			echo must specify a channel to join
+		if not if(test -e /n/chat/$talk(2)){
+			close
+			channel=$talk(2)
+			cat /n/chat/$channel &
+			catkill=$apid
+			echo JOIN $name to $channel >>/n/$chatsrv/$channel
+		}
+		if not
+			echo channel does not exist
+	case /h
+		helpmessage
+		echo currently in $channel
+		echo
+	case /c
+		echo Available channels:
+		lc /n/$chatsrv
+		echo -------------------
+		echo currently in $channel
+		echo
+	case *
+#		ts=`{date -u}
+#		ts=`{echo '('^$ts(4)^')'}
+		if(! ~ $talk ''){
+			line=`{echo $name '→ ' $talk}
+			echo $line >>/n/chat/$channel
+		}
+	}
+}
--- /dev/null
+++ b/bin/chord
@@ -1,0 +1,10 @@
+#!/bin/rc
+rfork n
+games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null || exit
+cat <<! | mst | games/dmid | games/opl3 | norm 5 | pplay
+t $1
+4 0c♭3 0e♭3 0g♭3
+4 0c♭3 0e♭3 0g♭3
+4 0c♭3 0e♭3 0g♭3
+4 0c♭3 0e♭3 0g♭3
+!
--- /dev/null
+++ b/bin/cinrio
@@ -1,0 +1,6 @@
+#!/bin/rc -e
+truetypefs
+font=/n/ttf/unifont.ttf.16/font
+plumber
+rio
+unmount /mnt/plumb
--- /dev/null
+++ b/bin/cpurio
@@ -1,0 +1,34 @@
+#!/bin/rc
+if(! ~ $sysname aib && ~ `{ns | grep '#v'} ''){
+	screenrc
+	echo softscreen off >'#v/vgactl'
+	echo hwaccel on >'#v/vgactl'
+}
+rfork efns	# weeeee
+font=/lib/font/bit/uga.font
+bind -a '#A' /dev
+bind -c $home/tmp /tmp
+bind -a $home/bin/rc /bin
+bind -a $home/bin/$cputype /bin
+test -f $home/p/rc/bindbins && . $home/p/rc/bindbins
+test -f $home/lib/ass){
+	auth/factotum
+	setec
+}
+webcookies
+webfs
+plumber
+switch($sysname){
+case w500
+	echo pin 22 >'#A'/audioctl
+	echo inpin 23 >'#A'/audioctl
+case hsw
+	echo pin 27 >'#A/audioctl'
+	echo inpin 25 >'#A'/audioctl
+}
+if(! ~ $sysname aib)
+	echo master 40 >'#A/volume'
+echo accelerated 3 >'#m'/mousectl
+prompt=('; ' '	')
+rio -i riostart
+# might be nice to do dontkill '^(rio|rc)$'
--- /dev/null
+++ b/bin/dmlotr
@@ -1,0 +1,13 @@
+#!/bin/rc -xe
+t=/tmp/dmlotr.$pid
+f='http://www.shamusyoung.com/twentysidedtale/?p=612'
+while(){
+	hget $f | sed 's/[<>]/\n/g' >$t
+	for(i in `{sed -n 's/.*img src=''(http.*\/images\/[^'']+)''.*/\1/p' $t})
+		dw $i
+	f=`{sed -n 's/.*a href="(http[^\?]+\?p=[^"]+)".*/\1/p' $t | sed -n '5{p;q;}'}
+	if(~ $#f 0){
+		rm $t
+		exit
+	}
+}
--- /dev/null
+++ b/bin/dmus.mp3
@@ -1,0 +1,94 @@
+#!/bin/rc
+# this overrides music in final doom and any custom music in pwads, since the
+# labels are hardcoded in the source.
+switch($2){
+	case adrian
+		f=$home/m/doom2.adrians.asleep.mp3
+	case ampie
+		f=$home/m/doom2.bye.bye.american.pie.mp3
+	case betwee
+		f=$home/m/doom2.between.levels.mp3
+	case bunny
+		f=$home/m/doom.bunny.mp3
+	case countd count2
+		f=$home/m/doom2.countdown.to.death.mp3
+	case dead dead2
+		f=$home/m/doom2.the.demons.dead.mp3
+	case dm2ttl
+		f=$home/m/doom2.intro.mp3
+	case dm2int
+		f=$home/m/doom2.intermission.mp3
+	case doom doom2
+		f=$home/m/doom2.doom.mp3
+	case ddtblu ddtbl2 ddtbl3
+		f=$home/m/doom2.the.dave.d.taylor.blues.mp3
+	case e1m1
+		f=$home/m/doom.at.dooms.gate.mp3
+	case e1m2
+		f=$home/m/doom.the.imps.song.mp3
+	case e1m3
+		f=$home/m/doom.dark.halls.mp3
+	case e1m4
+		f=$home/m/doom.kitchen.ace.and.taking.names.mp3
+	case e1m5
+		f=$home/m/doom.suspense.mp3
+	case e1m6 e3m6
+		f=$home/m/doom.on.the.hunt.mp3
+	case e1m7 e2m5 e3m5
+		f=$home/m/doom.demons.on.the.prey.mp3
+	case e1m8 e3m4
+		f=$home/m/doom.sign.of.evil.mp3
+	case e1m9 e3m9
+		f=$home/m/doom.hiding.the.secrets.mp3
+	case e2m1
+		f=$home/m/doom.i.sawed.the.demons.mp3
+	case e2m2
+		f=$home/m/doom.the.demons.from.adrians.pen.mp3
+	case e2m3 inter
+		f=$home/m/doom.intermission.from.doom.mp3
+	case e2m4
+		f=$home/m/doom.theyre.going.to.get.you.mp3
+	case e2m6
+		f=$home/m/doom.sinister.mp3
+	case e2m7 e3m7
+		f=$home/m/doom.waltz.of.the.demons.mp3
+	case e2m8
+		f=$home/m/doom.nobody.told.me.about.id.mp3
+	case e2m9 e3m1
+		f=$home/m/doom.untitled.mp3
+	case e3m2
+		f=$home/m/doom.donna.to.the.rescue.mp3
+	case e3m3
+		f=$home/m/doom.deep.into.the.code.mp3
+	case e3m8
+		f=$home/m/doom.facing.the.spider.mp3
+	case evil
+		f=$home/m/doom2.evil.incarnate.mp3
+	case in_cit
+		f=$home/m/doom2.into.sandys.city.mp3
+	case intro
+		f=$home/m/doom.title.mp3
+	case messag messg2
+		f=$home/m/doom2.message.from.the.archvile.mp3
+	case openin
+		f=$home/m/doom2.opening.to.hell.mp3
+	case read_m
+		f=$home/m/doom2.end.mp3
+	case romero romer2
+		f=$home/m/doom2.waiting.for.romero.to.play.mp3
+	case runnin runni2
+		f=$home/m/doom2.running.from.evil.mp3
+	case shawn shawn2 shawn3
+		f=$home/m/doom2.shawns.got.the.shotgun.mp3
+	case stalks stlks2 stlks3
+		f=$home/m/doom2.the.healer.stalks.mp3
+	case tense
+		f=$home/m/doom2.getting.too.tense.mp3
+	case the_da theda2 theda3
+		f=$home/m/doom2.in.the.dark.mp3
+	case ultima
+		f=$home/m/doom2.the.ultimate.challenge.mp3
+	case victor
+		f=$home/m/doom.victor.mp3
+	}
+audio/mp3dec <$f
--- /dev/null
+++ b/bin/doom
@@ -1,0 +1,58 @@
+#!/bin/rc -e
+# set up namespace for a particular version of doom and launch it
+# default setup:
+# - $home/lib/doom: mntpt and location of config file
+# - $home/lib/doom/$game: user game directories: savegames and screenshots
+# - /sys/games/lib/doom/$game: system iwad and pwad directories
+# cwd is bound over $mntpt to allow loading stuff from there
+# example: launch doom2 with scythe.wad (both in /sys/games/lib/doom/d2)
+#	; doom d2 -file scythe.wad
+# example game version names:
+# doom.wad → /sys/games/lib/doom/d1/
+# doom2.wad → /sys/games/lib/doom/d2/
+# doom2f.wad → /sys/games/lib/doom/d2f/
+# doom1.wad → /sys/games/lib/doom/dsh/
+# plutonia.wad → /sys/games/lib/doom/plt/
+# tnt.wad → /sys/games/lib/doom/tnt/
+# doomu.wad → /sys/games/lib/doom/ud/
+
+rfork ne
+flagfmt='b,l,z,m mntpt'
+args='game [params]'
+if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
+	aux/usage
+	exit usage
+}
+mntpt=$home/lib/doom
+if(~ $#flagm 1)
+	mntpt=$flagm
+if(! test -d $mntpt/$1)
+	mkdir -p $mntpt/$1
+bind -ac $mntpt/$1 $mntpt
+if(test -d /sys/games/lib/doom/$1)
+	bind -a /sys/games/lib/doom/$1 $mntpt
+if(! ~ $flagb 1)
+	bind -b `{pwd} $mntpt
+cd $mntpt
+
+# max scaling factor is 4 unless doom itself is patched
+if(~ $#vgasize 0 || ~ $flagz 1)
+	r=(-dx 328 -dy 208)
+if not
+	r=`{echo $vgasize |\
+		awk -Fx '{
+			a=$1/320;
+			b=$2/200;
+			c=int(b<a?b:a);
+			if(c*320 == $1 || c*200 == $2)
+				c--;
+			print "-dx", c*320+8, "-dy", c*200+8
+		}'
+	}
+if(! ~ $flagz 1)
+	echo resize $r >/dev/wctl
+
+if(! ~ $flagl 1)
+	games/doom $* >/dev/null
+if not
+	games/doom $* >/tmp/doomlog.$pid >[2=1]
--- /dev/null
+++ b/bin/dp
@@ -1,0 +1,7 @@
+#!/bin/rc
+
+audio/pcmconv -i u32r1c1 -o U32r1c1 <$home/dport*.bin >/dev/pl
+mkdir '#g'/fb
+echo 'va 0x40000000 0x10000000 fixed' > '#g'/fb/ctl
+@{ rfork n; run >/dev/null; bind -b '#i' /dev }	# ?
+
--- /dev/null
+++ b/bin/dpal
@@ -1,0 +1,16 @@
+#!/bin/rc
+# convert selected playpal palette to spred(1) format
+# FIXME: includes garbage past the end
+pn=0
+while(~ $1 -n){
+	pn=$2
+	shift 2
+}
+echo pal 256
+dd -bs 768 -skip $pn -count 1 <$1 >[2]/dev/null \
+	| xd -1x \
+	| ssam '
+,s/^....... +//g
+s/\n/ /g
+s/(..) (..) (..) /0x\1\2\3\n/g
+'
--- /dev/null
+++ b/bin/duck
@@ -1,0 +1,3 @@
+#!/bin/rc
+#plumb -d web 'http://duckduckgo.com/lite'
+mothra 'http://duckduckgo.com/lite'
--- /dev/null
+++ b/bin/dw
@@ -1,0 +1,11 @@
+#!/bin/rc
+if(~ $1 -o){
+	of=1
+	shift
+}
+for(i in $*){
+	f=`{echo $i | sed -n 's,.*/([^/]+)$,\1,p'}
+	if(! ~ $#of 0 || ! test -e $f)
+		echo $f'
+'$i
+} | xargs -n 2 -p 10 hget -o
--- /dev/null
+++ b/bin/edit
@@ -1,0 +1,2 @@
+#!/bin/rc
+B /dev/wsys/`{sed 's/[ 	]+//g' /dev/winid}^/text
--- /dev/null
+++ b/bin/eth0
@@ -1,0 +1,4 @@
+#!/bin/rc
+ip/ipconfig ether /net/ether1 unbind
+Kill wpa | rc
+ip/ipconfig ether /net/ether0
--- /dev/null
+++ b/bin/fpl
@@ -1,0 +1,6 @@
+#!/bin/rc
+ps -n | awk '
+/ play$/ { g[++i] = $3 }
+{ for(n=1; n<=i; n++) if(g[n] == $3) p[n] = $2 }
+END { for(n=1; n<=i; n++) print p[n] }
+'
--- /dev/null
+++ b/bin/frequenzbohrer
@@ -1,0 +1,86 @@
+#!/bin/awk -f
+# ; mkdir $home/mid
+# ; for(i in $notestringsbelow) echo 2 0^$i | mst | games/midi -c > $home/mid/^$i^.pcm
+
+function extant(v, a){
+	for(e in a)
+		if(a[e] == v)
+			return 1
+	return 0
+}
+
+function addrange(n){
+	i = length(roster) + 1
+	for(o in range){
+		m = n + range[o]
+		if(m > 0 && m <= length(note) && !extant(m, roster))
+			roster[i++] = m
+	}
+}
+
+function new(){
+	print "Find die noten, allied schweinhund!"
+	for(i in qs){
+		do
+			n = int(rand() * 10000000 % length(roster) + 1)
+		while(extant(roster[n], qs))
+		qs[i] = roster[n]
+	}
+	for(i in keys)
+		qs[int(rand() * 10000000 % length(qs) + 1)] = keys[i]
+	cmd = "cat $home/mid/^("
+	for(i=1; i<=length(qs); i++)
+		cmd = cmd note[qs[i]] ".pcm "
+	cmd = cmd ") >/dev/audio"
+	system(cmd)
+}
+
+BEGIN{
+	split("\
+c0 c♯0 d0 d♯0 e0 f0 f♯0 g0 g♯0 a0 a♯0 b0 \
+c1 c♯1 d1 d♯1 e1 f1 f♯1 g1 g♯1 a1 a♯1 b1 \
+c2 c♯2 d2 d♯2 e2 f2 f♯2 g2 g♯2 a2 a♯2 b2 \
+c3 c♯3 d3 d♯3 e3 f3 f♯3 g3 g♯3 a3 a♯3 b3 \
+c4 c♯4 d4 d♯4 e4 f4 f♯4 g4 g♯4 a4 a♯4 b4 \
+c5 c♯5 d5 d♯5 e5 f5 f♯5 g5 g♯5 a5 a♯5 b5 \
+c6 c♯6 d6 d♯6 e6 f6 f♯6 g6 g♯6 a6 a♯6 b6 \
+c7 c♯7 d7 d♯7 e7 f7 f♯7 g7 g♯7 a7 a♯7 b7 \
+c8 c♯8 d8 d♯8 e8 f8 f♯8 g8 g♯8 a8 a♯8 b8 \
+c9 c♯9 d9 d♯9 e9 f9 f♯9 g9 g♯9 a9 a♯9 b9 \
+c10 c♯10 d10 d♯10 e10 f10 f♯10 g10", note)
+	# FIXME: just have all notes from octaves -1,0,+1
+	split("-12 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 12 1 2 3 4 5 6 7 8 9 10 11", range)
+	srand()
+	print "Vich noten shall wir testen diese day, bastard?"
+}
+NR == 1{
+	n = split($0, keys)
+	if(n < 1)
+		exit("no notes to hand")
+	for(k in keys){
+		m = 0
+		for(n in note){
+			if(keys[k] == note[n]){
+				m = n
+				break
+			}
+		}
+		if(m == 0){
+			print "unknown note " keys[k]
+			exit("unknown note " keys[k])
+		}
+		keys[k] = m
+		addrange(m)
+	}
+	for(i=1; i<=6*length(keys); i++)
+		qs[i] = 0
+	new()
+}
+NR > 1{
+	# FIXME: just choose one of the notes at random; only test one note;
+	# say which one it's testing
+	for(i=1; i<=NF; i++)
+		if(!($i in qs) || !extant(qs[$i], keys))
+			print "NEIN!  Es ist " note[qs[$i]] "!"
+	new()
+}
--- /dev/null
+++ b/bin/gba
@@ -1,0 +1,15 @@
+#!/bin/rc
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/240;
+		b=$2/160;
+		c=int(b<a?b:a);
+		if(c*240 == $1 || c*160 == $2)
+			c--;
+		print "-dx", c*240+8, "-dy", c*160+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/gba -a $*(3-) || games/gba $*(3-)}
+if not
+	games/gba -a $* || games/gba $*
--- /dev/null
+++ b/bin/gbc
@@ -1,0 +1,15 @@
+#!/bin/rc -e
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/160;
+		b=$2/144;
+		c=int(b<a?b:a);
+		if(c*160 == $1 || c*144 == $2)
+			c--;
+		print "-dx", c*160+8, "-dy", c*144+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/gb -a $*(3-) || games/gb $*(3-)}
+if not
+	games/gb -a $* || games/gb $*
--- /dev/null
+++ b/bin/genpw
@@ -1,0 +1,8 @@
+#!/bin/rc
+n=32
+if(~ $1 -n){
+	n=$2
+	shift 2
+}
+tr -cd ' '-~ </dev/random | read -c $n
+echo
--- /dev/null
+++ b/bin/gridreg
@@ -1,0 +1,13 @@
+#!/bin/rc
+rfork n
+srv tcp!registry.9p.zone!registry registry /mnt/registry
+rm /srv/registry
+cd /mnt/registry
+>new{
+	echo tcp!9dump!9fs description '''read-only file dump''' contact qwx@sciops.net type fileserver
+	tail -f event
+} &
+>new{
+	echo tcp!9dump!t9fs description '''tls 9dump, ask for credentials''' contact qwx@sciops.net type fileserver
+	tail -f event
+}
--- /dev/null
+++ b/bin/imfdec
@@ -1,0 +1,27 @@
+#!/bin/rc
+rate=49716
+norm=()
+bareimf=()
+while(~ $1 -?){
+	switch($1){
+	case -r
+		rate=$2
+		shift
+	case -f
+		norm=$2
+		shift
+	case -n
+		bareimf=1
+	case *
+		echo usage: $0 '[-n] [-r rate] [-f norm]'
+		exit usage
+	}
+	shift
+}
+cmd=(opl2 -r $rate)
+if(~ $#bareimf 0)
+	cmd=(imf '|' $cmd)
+if(! ~ $#norm 0)
+	cmd=($cmd '|' norm $norm)
+echo $cmd
+eval $cmd
--- /dev/null
+++ b/bin/joygba
@@ -1,0 +1,37 @@
+#!/bin/rc
+# run as "nusb/joy epX.Y | joygba"
+
+awk -safe '
+	BEGIN { k[0] = "" }
+
+	/^axis 0 0/   { k[0] = "left " }
+	/^axis 0 255/ { k[0] = "right " }
+	/^axis 0 128/ { k[0] = "" }
+
+	/^axis 1 0/   { k[1] = "up " }
+	/^axis 1 255/ { k[1] = "down " }
+	/^axis 1 128/ { k[1] = "" }
+
+	/^down 1$/ { k[3] = "b " }
+	/^down 5$/ { k[2] = "a " }
+	/^down 6$/ { k[8] = "x " }
+	/^down 2$/ { k[9] = "y " }
+	/^down 3$/ { k[4] = "control " }
+	/^down 4$/ { k[5] = "start " }
+	/^down 7$/ { k[6] = "l1 " }
+	/^down 8$/ { k[7] = "r1 " }
+
+	/^up 1$/ { k[3] = "" }
+	/^up 5$/ { k[2] = "" }
+	/^up 6$/ { k[8] = "" }
+	/^up 2$/ { k[9] = "" }
+	/^up 3$/ { k[4] = "" }
+	/^up 4$/ { k[5] = "" }
+	/^up 7$/ { k[6] = "" }
+	/^up 8$/ { k[7] = "" }
+
+	{
+		print k[0] k[1] k[2] k[3] k[4] k[5] k[6] k[7] k[8] k[9]
+		fflush
+	}
+'
--- /dev/null
+++ b/bin/joygba2
@@ -1,0 +1,37 @@
+#!/bin/rc
+# run as "nusb/joy epX.Y | joygba"
+
+awk -safe '
+	BEGIN { k[0] = "" }
+
+	/^axis 0 0/   { k[0] = "left " }
+	/^axis 0 255/ { k[0] = "right " }
+	/^axis 0 128/ { k[0] = "" }
+
+	/^axis 1 0/   { k[1] = "up " }
+	/^axis 1 255/ { k[1] = "down " }
+	/^axis 1 128/ { k[1] = "" }
+
+	/^down 2$/ { k[3] = "b " }
+	/^down 1$/ { k[2] = "a " }
+	/^down 3$/ { k[8] = "x " }
+	/^down 4$/ { k[9] = "y " }
+	/^down 7$/ { k[4] = "control " }
+	/^down 8$/ { k[5] = "start " }
+	/^down 5$/ { k[6] = "l1 " }
+	/^down 6$/ { k[7] = "r1 " }
+
+	/^up 2$/ { k[3] = "" }
+	/^up 1$/ { k[2] = "" }
+	/^up 3$/ { k[8] = "" }
+	/^up 4$/ { k[9] = "" }
+	/^up 7$/ { k[4] = "" }
+	/^up 8$/ { k[5] = "" }
+	/^up 5$/ { k[6] = "" }
+	/^up 6$/ { k[7] = "" }
+
+	{
+		print k[0] k[1] k[2] k[3] k[4] k[5] k[6] k[7] k[8] k[9]
+		fflush
+	}
+'
--- /dev/null
+++ b/bin/joynes
@@ -1,0 +1,33 @@
+#!/bin/rc
+# run as "nusb/joy epX.Y | joynes N", where N=[1,2]
+
+awk -safe -v 'joy='joy$1 '
+	BEGIN { k[0] = "" }
+
+	/^axis 0 0/   { k[0] = "left " }
+	/^axis 0 255/ { k[0] = "right " }
+	/^axis 0 128/ { k[0] = "" }
+
+	/^axis 1 0/   { k[1] = "up " }
+	/^axis 1 255/ { k[1] = "down " }
+	/^axis 1 128/ { k[1] = "" }
+
+	/^down 2$/ { k[3] = "b " }
+	/^down 1$/ { k[2] = "a " }
+	#/^down 3$/ { k[4] = "control " }
+	#/^down 4$/ { k[5] = "start " }
+	/^down 7$/ { k[4] = "control " }
+	/^down 8$/ { k[5] = "start " }
+
+	/^up 2$/ { k[3] = "" }
+	/^up 1$/ { k[2] = "" }
+	#/^up 3$/ { k[4] = "" }
+	#/^up 4$/ { k[5] = "" }
+	/^up 7$/ { k[4] = "" }
+	/^up 8$/ { k[5] = "" }
+
+	{
+		print joy " " k[0] k[1] k[2] k[3] k[4] k[5]
+		fflush
+	}
+'
--- /dev/null
+++ b/bin/khinmidi
@@ -1,0 +1,12 @@
+#!/bin/rc
+flag e +
+
+for(i in $*){
+	x=`{echo $i | sed -n 's/.*\/([^\/]+)$/\1/p'}
+	mkdir -p $x && cd $x
+	hget $i |\
+		sed -n '/\.mid/s/^.*<a href="(.*)".*/\1/p' |\
+		uniq |\
+		xargs dw
+	cd ..
+}
--- /dev/null
+++ b/bin/khinsider
@@ -1,0 +1,14 @@
+#!/bin/rc
+flag e +
+
+for(i in $*){
+	x=`{echo $i | sed -n 's/.*\/([^\/]+)$/\1/p'}
+	mkdir -p $x && cd $x
+	hget $i |\
+		sed -n '/\.mp3/s/^.*<a href="(.*)".*/\1/p' |\
+		uniq |\
+		xargs -n 1 hget |\
+		sed -n '/^<audio/s/<audio id=".*" src="(.*\.mp3)".*/\1/p' |\
+		xargs dw
+		cd ..
+}
--- /dev/null
+++ b/bin/lofi
@@ -1,0 +1,3 @@
+#!/bin/rc
+play -o /fd/1 >[2]/dev/null |\
+	audio/opusenc --music --downmix-stereo --bitrate 64
--- /dev/null
+++ b/bin/md
@@ -1,0 +1,15 @@
+#!/bin/rc
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/320;
+		b=$2/224;
+		c=int(b<a?b:a);
+		if(c*320 == $1 || c*224 == $2)
+			c--;
+		print "-dx", c*320+8, "-dy", c*224+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/md -a $*(3-) || games/md $*(3-)}
+if not
+	games/md -a $* || games/md $*
--- /dev/null
+++ b/bin/metro
@@ -1,0 +1,11 @@
+#!/bin/rc
+rfork n
+games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null || exit
+cat <<! | mst | games/dmid | games/opl3 | pplay
+t $1
+i 0 127
+4 0c5
+4 0c5
+4 0c5
+4 0c5
+!
--- /dev/null
+++ b/bin/mfmt
@@ -1,0 +1,16 @@
+#!/bin/rc
+pref=$1
+fmt=$2
+sed \
+	$pref^'
+	s/^''//
+	s/''$//
+	s/[\[\]\!,\(\)''\$\*\?:\;=\}\{`]//g
+	s/#/♯/g
+	s/\&/and/g
+	s/( - | |_)/./g
+	s/\.[^\.]+$/.'^$fmt^'/
+	s/ /./g
+	s/\.\.+/./g
+' |\
+	tr A-ZА-Я a-zа-я
--- /dev/null
+++ b/bin/mk9
@@ -1,0 +1,16 @@
+#!/bin/rc -ex
+9fs 9fat
+if(test -f /n/9fat/9pc64 || test -f /n/9fat/9pc){
+	rm /n/9fat/9bootfat
+	cp /386/9bootfat /n/9fat/
+	chmod +al /n/9fat/9bootfat
+}
+if(test -f /n/9fat/9pc64)
+	cp /amd64/9pc64 /n/9fat/
+if(test -f /n/9fat/9pc)
+	cp /386/9pc /n/9fat/
+if(test -f /n/9fat/9zynq)
+	cp /arm/9zynq /n/9fat/
+rm /srv/dos
+unmount /n/9fat
+unmount /n/9
--- /dev/null
+++ b/bin/mkall
@@ -1,0 +1,11 @@
+#!/bin/rc -e
+for(i in amd64 386 arm){
+	if(! ~ $#* 0)
+		objtype=$i mk $*^.install
+	if not
+		objtype=$i mk install
+}
+if(! ~ $#* 0)
+	mk $*^.clean
+if not
+	mk clean
--- /dev/null
+++ b/bin/mkcp
@@ -1,0 +1,2 @@
+#!/bin/rc
+disk/mkfs -z 4096 -s $1 -d $*(2-) /sys/lib/sysconfig/proto/allproto
--- /dev/null
+++ b/bin/mkradio
@@ -1,0 +1,12 @@
+#!/bin/rc
+rfork n
+rimport -C -c -u share aib /usr/share /n/share || exit rimport
+if(! ~ $#* 0)
+	t=$1
+if not
+	t=`{walk -demn /n/share/radio}
+cd $home/m
+for(i in `{walk -emn | awk '{if($1 > '^$t(1)^') print $2}'}){
+	echo $i
+	lofi <$i >/n/share/radio/$i
+}
--- /dev/null
+++ b/bin/mku
@@ -1,0 +1,170 @@
+#!/bin/rc -xe
+# gottagofast update script
+# FIXME: this script is FUCKING RETARDED
+# FIXME: idea: don't rfork n, allow fixing whatever and continuing build; better
+# error detection and recovery
+rfork en
+h=$home
+
+fn mkp{
+	cd $h/p
+	mk nuke
+	mk install && mk nuke || exit NOPE
+	cp -x opl2/man/1/opl2 pplay/man/1/pplay u6/man/1/u6mopl wl3d/man/1/wl3d /sys/man/1/
+	cp -x wl3d/man/6/wl3d /sys/man/6/
+	cd $h/p/qk2
+	for(i in mkfile.*){
+		bind $i mkfile
+		mk install && mk nuke || exit NOPE
+		unmount mkfile
+	}
+	for(i in spew/aplay ftrvxmtrx/imgtools ftrvxmtrx/mp3dec){
+		if(test -d $h/lib/extra/$i){
+			cd $h/lib/extra/$i
+			mk install && mk clean
+		}
+	}
+}
+
+if(! test -e $h/p){
+	h=/usr/qwx
+	if(! test -e $h/p)
+		exit 'no p to hand'
+}
+
+{
+cd /
+bind -ac /dist/plan9front /
+hg revert --no-backup \
+	/lib/vgadb\
+	/rc/bin/^(9fs ircrc play)\
+	/sys/lib/plumb/basic\
+	/sys/lib/kbmap\
+	/sys/man/1/audio\
+	/sys/man/4/nusb\
+	/sys/src/9/pc64/mkfile\
+
+sysupdate
+. /sys/lib/rootstub
+ramfs -um /n/mk
+@{cd /sys/src; tar c *} | @{cd /n/mk; tar x}
+bind /n/mk /sys/src
+
+#fplot-col\
+#life-col.patch\	FIXME: goddamnit burnzez
+colf=(\
+acme-col\
+kbmap-col\
+libdraw-menucol\
+colors-col\
+faces-col\
+samterm-col\
+spred-col\
+stats-col\
+statusmsg-col\
+statusbar-col\
+sudoku-col\
+mothra-col\
+vt-col\
+zuke-col\
+)
+
+f=(\
+9fs-9paste\
+9nusbrc-nesusbjoy\
+doom-autorun\
+doom-chat\
+doom-limits\
+doom-mouseglitches\
+doom-mousegrab\
+doom-naivescaleup\
+doom-nodclick\
+doom-skywallhit\
+doom-spy\
+doom-udpip\
+file-mod\
+file-opus\
+ircrc-jpmfix\
+ircrc-print-log\
+kbdfs-fshalt\
+libplumb-basic\
+man1audio-opus\
+man-joy\
+mothra-font\
+page-invert\
+paint-reverse\
+play-dmid-mod\
+play-opus\
+png-maxmem\
+rio-exit\
+sam-fullfrontalnudity\
+samterm-fullfrontalnudity\
+samterm-flayers\
+troff-nchars\
+)
+
+ko=(amd64 386)
+k=(pc64 pc)
+switch($sysname){
+case hsw aib x220 t61p w520 u32
+	f=($f $colf)
+	ko=(amd64 386 arm)
+	k=(zynq pc pc64)
+case t61 t61p2 t60p w500
+	f=($f $colf)
+case ibm3000 t43
+	f=($f $colf)
+	ko=386
+	k=(pc)
+case *
+	ko=386
+	k=(pc)
+}
+for(i in $h/lib/extra/ftrvxmtrx/riow/9front.diff $h/lib/extra/ftrvxmtrx/patches/rio-select.patch $h/p/patch/$f)
+	ape/patch -s --no-backup-if-mismatch -p1 < $i
+cp -x $h/p/dot/vgadb /lib/vgadb
+rm -f (/lib/vgadb /rc/bin/ircrc /sys/man/4/nusb)^.orig
+
+cd /sys/src
+{
+	mk clean
+	for(i in $ko)
+		objtype=$i mk nuke
+	mk install || exit 'NOPE'
+	for(i in $ko)
+		if(! ~ $i $objtype)
+			objtype=$i mk install || exit 'NOPE'
+	mk clean
+	for(i in $ko)
+		objtype=$i mkp
+} | pump || exit 'NOPE'
+cd /sys/man
+mk
+
+for(i in $k){
+	cd /sys/src/9/^$i
+	mk clean && mk install && mk clean
+}
+9fs 9fat
+if(~ $objtype amd64 386){
+	rm /n/9fat/9bootfat
+	cp /386/9bootfat /n/9fat/
+	chmod +al /n/9fat/9bootfat
+}
+for(i in $k)
+	switch($i){
+	case pc
+		if(! ~ $sysname aib)
+			cp /386/9pc /n/9fat/
+	case pc64
+		if(! ~ $sysname aib)
+			cp /amd64/9pc64 /n/9fat/
+	case zynq
+		cp /arm/9zynq /n/9fat/
+	}
+unmount /n/9fat
+unmount /n/9
+rm /srv/dos
+} >>/tmp/mku.$pid
+#echo sync >>/srv/hjfs.cmd
+rm /tmp/mku.$pid
--- /dev/null
+++ b/bin/mlu
@@ -1,0 +1,8 @@
+#!/bin/rc
+if(! ~ $#* 2){
+	echo usage: $0 listname destdir
+	exit usage
+}
+9fs lists.9front.org
+cd /n/lists.9front.org/lists/$1
+syncab /n/lists.9front.org/lists/$1 $2 | tee | rc
--- /dev/null
+++ b/bin/mpi
@@ -1,0 +1,5 @@
+#!/bin/rc
+rfork n
+ep=ep9.4
+! ~ $#* 0 && ep=$1
+games/dmid -s /dev/usb/$ep/data | games/opl3 | norm 5 >/dev/audio
--- /dev/null
+++ b/bin/nes
@@ -1,0 +1,15 @@
+#!/bin/rc
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/256;
+		b=$2/240;
+		c=int(b<a?b:a);
+		if(c*256 == $1 || c*240 == $2)
+			c--;
+		print "-dx", c*256+8, "-dy", c*240+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba 1 | {games/nes -a $*(3-) || games/nes $*(3-)}
+if not
+	games/nes -a $* || games/nes $*
--- /dev/null
+++ b/bin/nesj
@@ -1,0 +1,20 @@
+#!/bin/rc
+
+n=`{sed -n '/ep.\.0/h;${g;s/^(ep.\.0).*/\1/p;}' /dev/usb/ctl}
+while(~ $1 -?){
+	switch($1){
+	case -k	# just make /sys/src/9/boot/nusbrc do nothing if it sees your
+		# device instead
+		p=`{ps | sed -n '/ kb$/h;${g;s/^[^ ]+ +([0-9]+) .*/\1/p;}'}
+		echo kill >/proc/$p/note
+		wait $p
+	case -n
+		n=ep$2.0
+		shift
+	}
+	shift
+}
+
+echo resize -dx 776 -dy 728 >/dev/wctl
+nusb/joy /dev/usb/$n | joynes 1 | games/nes -a3 $*
+# press Kdel again to kill nusb/joy...
--- /dev/null
+++ b/bin/oots
@@ -1,0 +1,24 @@
+#!/bin/rc
+# finds out which is the last comic, then downloads missing ones from cwd, exiting
+# upon the first collision
+# it's filthy.
+
+flag e +
+
+#x=(/comics/oots0002.html)
+x=(`{hget http://www.giantitp.com \
+| sed -n 's/<B>Order of the Stick <\/B><A href="([^"]+)".*/\1/p'})
+n=`{echo $x | sed 's/.*(oots[0-9]+\.)html/\1/'}
+while(! ~ $n '#' && ! test -e $n^*){
+	x=(`{hget http://www.giantitp.com/$x(1) \
+	| sed -n '
+		/IMG src="\/comics/{
+			s/.*src="([^"]+)".*/\1/p
+			q
+		}
+		s/.*<A href="([^"]+)"><IMG src="\/Images\/redesign\/ComicNav_Back.gif".*/\1/p'
+	})
+	n=$n^`{echo $x(2) | sed 's/.*\.([^\/\.]+)$/\1/'}
+	hget http://www.giantitp.com/$x(2) >$n
+	n=`{echo $x(1) | sed 's/.*(oots[0-9]+\.)html/\1/'}
+}
--- /dev/null
+++ b/bin/pcm2opus
@@ -1,0 +1,2 @@
+#!/bin/rc
+audio/opusenc --bitrate 128 --music --downmix-stereo 
--- /dev/null
+++ b/bin/pcmf
@@ -1,0 +1,10 @@
+#!/bin/rc
+rfork n
+t=/tmp/pplay.$pid
+fn clean{ rm -f $t }
+fn sigexit{ clean }
+fn sigint{ clean }
+ramfs
+play -o /tmp/pplay.$pid $* >[2]/dev/null
+pplay -f /tmp/pplay.$pid
+rm -f /tmp/pplay.$pid
--- /dev/null
+++ b/bin/psam
@@ -1,0 +1,18 @@
+#!/bin/rc
+r=()
+switch($vgasize){
+case 3840x2160x*
+	r=(0 564 3840 1882)
+case 1920x1200x*
+	r=(0 0 1920 1018)
+case 1920x1080x*
+	r=(0 0 1920 898)
+case 1600x1200x*
+	r=(0 0 1920 928)
+case 1400x1050x*
+	r=(0 0 1400 906)
+case 1366x768x*
+	r=(0 0 1366 625)
+}
+if(! ~ $#r 0)
+	window -m -r $r sam -a $* $home/p/not/todo.proj
--- /dev/null
+++ b/bin/qdemo
@@ -1,0 +1,13 @@
+#!/bin/rc
+window -r 952 0 1920 608 'cd lib/dm/plt; doom -z plt -noztele -playdemo dime >/dev/null >[2=1]'
+window -r 156 -1 964 607 'quake2 +set game q2dq2 >/dev/null >[2=1]'
+window -r 2 474 810 1082 'qk1 -m 24 >/dev/null >[2=1]'
+window -r 806 597 1454 1005 'wl3d -s'
+window -r 1450 596 1921 1081 'p $home/p/rc/qdemo; read -c 1'
+window -r 0 0 160 478 'stats -lmsc'
+window -scroll -r 806 1026 1194 1080 'play mv/gojira.torii.mp3 m/gojira.*'
+
+# todo: do these automatically:
+# q2dq2: map run/base1.dm2
+# qk1: playdemo start
+# wl3d: either find good demos, or just play a game while the rest is going
--- /dev/null
+++ b/bin/qk1
@@ -1,0 +1,14 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case x220 w520 t61p2 t61p
+	res=(-dx 1032 -dy 776)
+case hsw
+	res=(-dx 1608 -dy 1208)
+	a=(-m 32)
+case *
+	res=(-dx 808 -dy 608)
+}
+echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
+quake $a $* >/dev/null
--- /dev/null
+++ b/bin/qk2
@@ -1,0 +1,28 @@
+#!/bin/rc
+rfork ne
+res=(-dx 808 -dy 608)
+noresz=()
+c=(quake2)
+# launch ctf with: qk2 -g ctf $* +set ctf 1
+# launch crbot with: qk2 -g crbot $* +set deathmatch 1 +set ctf 0
+while(~ $1 -?){
+	switch($1){
+	case -g
+		# mods' executables are named q2$x
+		c=(q2$2 +set game $2)
+		shift
+	case -m
+		cdmnt=$2
+		shift
+	case -r
+		res=(-dx `{echo $2 + 8 | pc -n} -dy `{echo $3 + 8 | pc -n})
+		shift 2
+	case -z
+		noresz=1
+	}
+	shift
+}
+if(~ $#noresz 0)
+	echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake2/cd /mnt/cd	# cdfs(4)
+$c $* >/dev/null
--- /dev/null
+++ b/bin/qk3
@@ -1,0 +1,4 @@
+#!/bin/rc
+echo scroll >/dev/wctl
+#cd /sys/games/lib/quake3 && q3ded +set developer 1 +set fs_game cpma +map cpm22
+cd /sys/games/lib/quake3 && q3ded +set developer 1 +map q3dm17
--- /dev/null
+++ b/bin/qw
@@ -1,0 +1,13 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case x220 w520 t61p2 t61p
+	res=(-dx 1032 -dy 776)
+case hsw
+	res=(-dx 1608 -dy 1208)
+case *
+	res=(-dx 808 -dy 608)
+}
+echo resize $res >/dev/wctl
+bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
+qwcl -mem 32 $* >/dev/null
--- /dev/null
+++ b/bin/repou
@@ -1,0 +1,18 @@
+#!/bin/rc
+# giturl\tname\tdir\tdesc
+awk '
+BEGIN{
+	FS="\t"
+}$1 !~ /^(#|$)/{
+	print $2
+	basedir = $3
+	sub("/[^/]+$", "", basedir)
+	# yikes
+	if(system("test -d " $3) != 0){
+		system("mkdir -p " basedir)
+		system("git/clone " $1 " " $3)
+	}else{
+		system("rc -c \''cd " $3 "; git/pull\''")
+	}
+}
+' $home/p/lib/^(plan9 unix)
--- /dev/null
+++ b/bin/riostart
@@ -1,0 +1,10 @@
+#!/bin/rc
+sizes
+. /tmp/sizes
+window -scroll -r $kprintrect cat /dev/kprint
+window -r $catrect games/catclock
+window -r $volrect volume
+window -r $statrect stats -lmsedz
+window -scroll -r $cmdrect 'label cmd; rc'
+window -r $duckrect duck
+window -r $riowrect 'label riow; riow </srv/riogkbd*'
--- /dev/null
+++ b/bin/rsam
@@ -1,0 +1,44 @@
+#!/bin/rc
+rfork ne
+switch($vgasize){
+case 3840x2160x*
+	r=(0 564 3840 2152)
+	rs=(0 564 3840 1882)
+	rw=(0 1616 714 2160)
+case 1920x1200x*
+	r=(0 0 1920 1192)
+	rs=(0 0 1920 1018)
+	rw=(0 656 714 1200)
+case 1920x1080x*
+	r=(0 0 1920 1072)
+	rs=(0 0 1920 898)
+	rw=(0 536 714 1080)
+case 1600x1200x*
+	r=(0 0 1920 1192)
+	rs=(0 0 1920 928)
+	rw=(0 656 714 1200)
+case 1400x1050x*
+	r=(0 0 1400 1042)
+	rs=(0 0 1400 906)
+	rw=(0 506 714 1050)
+case 1366x768x*
+	r=(0 0 1366 760)
+	rs=(0 0 1366 625)
+	rw=(0 224 714 768)
+}
+if(~ $#r 0)
+	exit 'nope, unknown resolution'
+f=()
+if(test -f $home/lib/rsam){
+	f=`{cat $home/lib/rsam}
+	eval 'f=('^$"f^')'
+}
+cat <<! >/env/fuckrc
+unmount /mnt/plumb
+plumber
+rio -k '
+	window -r $rw -scroll
+	window -r $rs sam -a $* $f
+'
+!
+window -m -hide -r $r rc /env/fuckrc
--- /dev/null
+++ b/bin/shl
@@ -1,0 +1,11 @@
+#!/bin/rc
+awk '
+BEGIN{
+	srand()
+}
+{
+	printf "%06d	%s\n", rand() * 1000000, $0
+}
+' |\
+	sort -n |\
+	sed 's/^[0-9]+	//'
--- /dev/null
+++ b/bin/sizes
@@ -1,0 +1,76 @@
+#!/bin/rc
+screensize=`{echo $vgasize | sed 's/x/ /g'}
+#screensize=`{file /dev/screen | sed 's/.*size ([^x]+)x([^x]+)/\1 \2/'}
+# general placements
+briorect=(0 0 $screensize(1) `{echo $screensize(2) - 16 | pc -n})
+bsamrect=(0 0 $briorect(3) `{echo $briorect(4) - 64 | pc -n})
+bcmdrect=( \
+	0 \
+	`{echo $bsamrect(4) - $bsamrect(4) / 3 | pc -n} \
+	`{echo $bsamrect(3) / 3 | pc -n} \
+	$briorect(4) \
+)
+# default windows
+catrect=( \
+	0 \
+	0 \
+	130 \
+	296 \
+)
+volrect=( \
+	`{echo $catrect(3) + 4 | pc -n} \
+	0 \
+	768 \
+	28 \
+)
+kprintrect=( \
+	$volrect(1) \
+	`{echo $volrect(4) + 4 | pc -n} \
+	$volrect(3) \
+	`{echo $catrect(4) / 2 | pc -n} \
+)
+statrect=( \
+	$volrect(1) \
+	`{echo $kprintrect(4) + 4 | pc -n} \
+	$volrect(3) \
+	$catrect(4) \
+)
+cmdrect=( \
+	0 \
+	`{echo $catrect(4) + 4 | pc -n} \
+	$volrect(3) \
+	$screensize(2) \
+)
+riowrect=( \
+	`{echo $screensize(1) - 100 | pc -n} \
+	`{echo $screensize(2) - 28 | pc -n} \
+	$screensize(1) \
+	$screensize(2) \
+)
+zukerect=( \
+	`{echo $screensize(1) - 768 | pc -n} \
+	0 \
+	$screensize(1) \
+	$screensize(2) \
+)
+duckrect=( \
+	`{echo $screensize(1) / 2 | pc -n} \
+	0 \
+	$screensize(1) \
+	`{echo $screensize(2) - 256 | pc -n} \
+)
+
+cat <<! >/tmp/sizes
+screensize=($screensize)
+briorect=($briorect)
+bsamrect=($bsamrect)
+bcmdrect=($bcmdrect)
+catrect=($catrect)
+volrect=($volrect)
+kprintrect=($kprintrect)
+statrect=($statrect)
+cmdrect=($cmdrect)
+riowrect=($riowrect)
+zukerect=($zukerect)
+duckrect=($duckrect)
+!
--- /dev/null
+++ b/bin/skey
@@ -1,0 +1,4 @@
+#!/bin/rc
+rfork n
+games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null
+mkey | games/dmid -s | games/opl3 | norm 5 >/dev/audio
--- /dev/null
+++ b/bin/snes
@@ -1,0 +1,15 @@
+#!/bin/rc
+echo resize `{echo $vgasize |\
+	awk -Fx '{
+		a=$1/256;
+		b=$2/239;
+		c=int(b<a?b:a);
+		if(c*256 == $1 || c*239 == $2)
+			c--;
+		print "-dx", c*256+8, "-dy", c*239+8
+	}'
+} >/dev/wctl
+if(~ $1 -j)
+	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/snes -a $*(3-) || games/snes $*(3-)}
+if not
+	games/snes -a $* || games/snes $*
--- /dev/null
+++ b/bin/stealrc
@@ -1,0 +1,12 @@
+#!/bin/rc
+repo=$home/lib/extra
+dest=$home/bin/rc
+cp -x \
+	$repo/kvik/bin.rc/bin/^(last pfx) \
+	$repo/jpm/rc/^(fcalls fman h top ircx netproc irctime) \
+	$repo/ftrvxmtrx/rc/youtube \
+	$repo/aiju/rc/fun \
+	$repo/qrstuv/9paste \
+	$repo/sources.extra/ps2txt \
+	$repo/henesy/gelinks.rc \
+	$dest
--- /dev/null
+++ b/bin/syncab
@@ -1,0 +1,43 @@
+#!/bin/rc
+rfork n
+nomtime=0
+if(~ $1 -m){
+	nomtime=1
+	shift
+}
+if(! ~ $#* 2){
+	echo usage: $0 [-m] left right
+	exit usage
+}
+
+ref=$1
+old=$2
+derp -t $ref $ref $old |\
+	awk \
+	-F'	' \
+	-v 'ref='^$ref \
+	-v 'old='^$old \
+	-v 'nomtime='^$nomtime \
+'
+BEGIN{
+	rm["na"] = rm["dn"] = rm["dm!"] = 1
+	if(nomtime)
+		nocp["nm"] = 1
+}
+{
+	gsub("\''", "\''\''", $2)
+	if($1 in rm)
+		ls["rm"] = "''" old "/" $2 "'' " ls["rm"]
+	else if(! ($1 in nocp))
+		ls["cp"] = ls["cp"] " " "''" $2 "''"
+	cnt[$1]++
+}
+END{
+	for(i in cnt)
+		print "#" i, cnt[i]
+	if("rm" in ls)
+		print "rm", ls["rm"]
+	if("cp" in ls)
+		print "@{cd", ref, "; tar c", ls["cp"], "} | @{cd", old, "; tar xT}"
+}
+'
--- /dev/null
+++ b/bin/syncbv91
@@ -1,0 +1,29 @@
+#!/bin/rc -e
+rfork n
+if(! ~ $#* 1){
+	echo usage: $0 sys
+	exit usage
+}
+if(! sshfs tcp!$1!8022){
+	echo ssh failed: $status
+	exit ssh
+}
+cd
+# sd card mtimes are full of lies
+if(~ $1 ule){
+	for(i in m*){
+		if(! test -d /n/ssh/m)
+			ssh tcp!bv91!8022 ln -s storage/external-1/m m || exit
+		if(! test -d /n/ssh/m/$i)
+			clone -T $i /n/ssh/m/
+		if not
+			syncab -m $i /n/ssh/m/$i | tee -a /tmp/sync.$pid
+	}
+}
+syncab $home/lib/i /n/ssh/Pictures | tee -a /tmp/sync.$pid
+echo proceed?
+if(! ~ `{read} yes){
+	echo exiting
+	exit nope
+}
+. /tmp/sync.$pid && rm /tmp/sync.$pid
--- /dev/null
+++ b/bin/sysup
@@ -1,0 +1,5 @@
+#!/bin/rc -e
+bind -ac /dist/plan9front /
+old=`{git/query HEAD}
+sysupdate
+git/query -c $old HEAD
--- /dev/null
+++ b/bin/t
@@ -1,0 +1,4 @@
+#!/bin/rc
+if(~ $#* 1)
+	*=(ssh tcp!$1!x)
+vt -2bf /lib/font/bit/fixed/unicode.6x10.font $*
--- /dev/null
+++ b/bin/tac
@@ -1,0 +1,8 @@
+#!/bin/awk -f
+{
+	l[NR] = $0
+}
+END{
+	while(NR > 0)
+		print l[NR--]
+}
--- /dev/null
+++ b/bin/tcp19000
@@ -1,0 +1,4 @@
+#!/bin/rc
+cd /usr/share/radio
+while(~ $status '')
+	dd -bs 512x1024 -if `{fortune <{ls}} >[2]/dev/null
--- /dev/null
+++ b/bin/tcp19564
@@ -1,0 +1,2 @@
+#!/bin/rc
+exec tlssrv -A -l 9dump -r `{cat $3/remote} /bin/exportfs -R -r /usr/share
--- /dev/null
+++ b/bin/theme
@@ -1,0 +1,2 @@
+#!/bin/rc
+picker </dev/theme >/dev/theme
--- /dev/null
+++ b/bin/themeset
@@ -1,0 +1,5 @@
+#!/bin/rc -e
+cat $home/lib/theme/rio >/mnt/wsys/theme
+sleep 0.5
+grep softscreen /dev/vgactl >>/dev/vgactl
+echo hwblank off >>/dev/vgactl
--- /dev/null
+++ b/bin/tospr
@@ -1,0 +1,51 @@
+#!/bin/rc -e
+# FIXME: includes garbage past the end
+fn cleanup{
+	if(! ~ $#tf 0)
+		rm -f $tf
+	tf=()
+}
+fn sigint{
+	cleanup
+	exit
+}
+fn sigexit{
+	cleanup
+}
+
+if(! ~ $#* 2){
+	echo usage: $0 pal image
+	exit usage
+}
+tf=/tmp/tospr.$pid
+iconv -uc r8g8b8 $2 > $tf
+r=`{awk '{ print $4-$2, $5-$3; exit }' $tf}
+awk '
+NR == 1{
+	npal = $2
+}
+FNR == NR && NR != 1{
+	pal[$1] = NR-2
+}
+FNR == 1 && NR != 1{
+	print "sprite", '^$r(1)^,^$r(2)^',"'^$1^'"
+}
+FNR != NR{
+	if($1 in pal)
+		printf "%d ", pal[$1]
+	else{
+		print "value " $1 " not in palette!"
+		exit
+	}
+	if(++px == '^$r(1)^'){
+		printf "\n"
+		px = 0
+	}
+}
+' $1 <{dd -bs 5x12 -skip 1 <$tf >[2]/dev/null \
+	| xd -1x \
+	| ssam '
+,s/^....... +//g
+s/\n/ /g
+s/(..) (..) (..) /0x\3\2\1\n/g
+'}
--- /dev/null
+++ b/bin/tx
@@ -1,0 +1,4 @@
+#!/bin/rc
+if(~ $#* 1)
+	*=(ssh tcp!$1!x)
+vt -xbf /lib/font/bit/fixed/unicode.6x10.font $*
--- /dev/null
+++ b/bin/ufo
@@ -1,0 +1,6 @@
+#!/bin/rc -e
+rfork n
+srv tcp!plan-nue.youkai.pw!4458 ufo /n/ufo
+rm /srv/ufo
+audio/mixfs
+rio -k 'window ''echo ''''pump -k 51200 -b 131072 </n/ufo/radio | audio/mp3dec >/dev/audio''''; rc'''
--- /dev/null
+++ b/bin/unhex
@@ -1,0 +1,17 @@
+#!/bin/awk -f
+# dd ... | xd -1x | ssam '...' | unhex | dd ...
+function hex(s, v){
+	if(s ~ /^0x/)
+		s = substr(s, 3)
+	for(n=1; n<=length(s); n++)
+		v = v * 16 + h[substr(s, n, 1)]
+	return v
+}
+BEGIN{
+	for(n=0; n<16; n++)
+		h[sprintf("%x", n)] = n
+}
+{
+	for(i=2; i<=NF; i++)
+		printf "%c", hex("0x" $i)
+}
--- /dev/null
+++ b/bin/unspr
@@ -1,0 +1,44 @@
+#!/bin/rc
+if(! ~ $#* 2){
+	echo usage: $0 pal spr
+	exit usage
+}
+awk '
+function hex(s, v){
+	if(s ~ /^0x/)
+		s = substr(s, 3)
+	for(n=1; n<=length(s); n++)
+		v = v * 16 + h[substr(s, n, 1)]
+	return v
+}
+BEGIN{
+	for(n=0; n<16; n++){
+		h[sprintf("%x", n)] = n
+		h[sprintf("%X", n)] = n
+	}
+}
+FNR == 1{
+	x = $2
+	y = $3
+}
+FNR == NR{
+	sub(/0x/, "")
+	gsub(/../, "0x& ")
+	split($0, a)
+	c[i,3] = hex(a[1])
+	c[i,2] = hex(a[2])
+	c[i,1] = hex(a[3])
+	i++
+	next
+}
+{
+	if(FNR == 1){
+		printf "     r8g8b8           0           0%12d%12d ", x, y
+		next
+	}
+	for(i=1; i<=NF; i++){
+		n = $i + 1
+		printf "%c%c%c", c[n,1], c[n,2], c[n,3]
+	}
+}
+' $1 $2
--- /dev/null
+++ b/bin/v
@@ -1,0 +1,16 @@
+#!/bin/rc
+rfork n
+if(~ $#* 0){
+	echo usage: $0 sys [vncvopts..]
+	exit usage
+}
+switch($1){
+case aib
+case t16
+case t30
+	sshnet tcp!$1!x || exit
+	*=u30
+case *
+	sshnet tcp!$1!x || exit
+}
+vncv -l utf8 -e corre $*
--- /dev/null
+++ b/bin/v+
@@ -1,0 +1,2 @@
+#!/bin/rc
+awk '/^master/{print $1, $2+5}' /dev/volume >/dev/volume
--- /dev/null
+++ b/bin/v-
@@ -1,0 +1,2 @@
+#!/bin/rc
+awk '/^master/{print $1, $2-5}' /dev/volume >/dev/volume
--- /dev/null
+++ b/bin/vmx9
@@ -1,0 +1,22 @@
+#!/bin/rc
+rfork n
+switch($sysname){
+case w520
+	if(test -d /net/ether1)
+		n=ether1
+	if not
+		n=ether0
+	m=3G
+	echo scroll >/dev/wctl
+	vmx \
+		-M $m \
+		-n $n \
+		-d /tmp/iso/9front-6977.c7e7268b0786.iso \
+		-d /dev/sdE3/data \
+		-v 1024x768 \
+		$bootfile \
+		'user=glenda mouseport=ps2'
+	echo quit >'#X'/0/ctl
+case *
+	echo nope.
+}
--- /dev/null
+++ b/bin/vmxants
@@ -1,0 +1,22 @@
+#!/bin/rc
+rfork n
+switch($sysname){
+case w520
+	if(test -d /net/ether1)
+		n=ether1
+	if not
+		n=ether0
+	m=3G
+	echo scroll >/dev/wctl
+	vmx \
+		-M $m \
+		-n $n \
+		-d /dev/sdE3/data \
+		-d /dev/sdUbff05/data \
+		-v 1024x768 \
+		$home/vmx/9ants64 \
+		'user=glenda mouseport=ps2 bootcmd=plan9rc tgzfs=no cdboot=yes'
+	echo quit >'#X'/0/ctl
+case *
+	echo nope.
+}
--- /dev/null
+++ b/bin/vmxbsd
@@ -1,0 +1,58 @@
+#!/bin/rc
+rfork n
+if(test -d /net/ether1)
+	n=ether1
+if not
+	n=ether0
+switch($sysname){
+case u32
+	n=ether0
+	m=2G
+	d=/dev/sdU7af84/data
+	echo scroll >/dev/wctl
+	vmx \
+		-M $m \
+		-n $n \
+		-d $d \
+		-v vesa:1280x1024 \
+		/tmp/vmx/bsd65.rd \
+		'device=sd0a'
+case w520
+	if(~ $cputype amd64)
+		m=3G
+	if not
+		m=1G
+	if(test -f /tmp/vmx/bsd.img)
+		d=/tmp/vmx/bsd.img
+	if not
+		d=/dev/sdE1/data
+	if(test -f /dev/sdU999b0.0/data)
+		d=($d -d /dev/sdU999b0.0/data)
+	if(test -f /dev/sdU999b0.1/data)
+		d=($d -d /dev/sdU999b0.1/data)
+	echo scroll >/dev/wctl
+	vmx \
+		-M $m \
+		-n $n \
+		-d $d \
+		-v vesa:1200x800 \
+		/tmp/vmx/bsd65.sp \
+		'device=sd0a'
+case x220
+	if(~ $cputype amd64)
+		m=4G
+	if not
+		m=1G
+	echo scroll >/dev/wctl
+	vmx \
+		-M $m \
+		-n $n \
+		-d /dev/sdE0/data \
+		-v vesa:1366x768 \
+		$home/vmx/bsd64.sp \
+		'device=sd0a'
+case *
+	echo nope.
+	exit nope.
+}
+echo quit >'#X'/0/ctl
--- /dev/null
+++ b/bin/vmxlinux
@@ -1,0 +1,62 @@
+#!/bin/rc
+rfork n
+
+vmid=`{awk '
+BEGIN{
+	i = 0
+	while(system("test -e \''#X\''/" i) == 0)
+		i++
+	print i
+}'}
+
+fn clean{
+	for(i in '#X'/$vmid/ctl)
+		echo quit > $i
+}
+fn sigexit{
+	clean
+}
+fn sigint{
+	clean
+}
+
+ver=5.12.14_1
+mac=2ec3bc946389
+n=ether0
+M=12G
+k=/tmp/vmx/vmlinuz-$ver
+m=/tmp/vmx/initramfs-^$ver^.img
+d=/dev/sdE0/data
+v=1280x1024
+c=('root=/dev/vda1')
+if(test -d '#l1'){
+	bind -aq '#l1' /net
+	n=ether1
+}
+while(~ $1 -?){
+	switch($1){
+	case -d; d=$2; shift;
+	case -e; d=($d -d $2); shift;
+	case -k; k=$2; shift;
+	case -l; psd listen || aux/listen;
+	case -M; M=$2; shift;
+	case -m; m=$2; shift;
+	case -n; n=$2; shift;
+	case -v; v=$2; shift;
+	case --; break;
+	case *
+		echo usage: $0 [opts] [--] [more opts]
+		exit usage
+	}
+	shift
+}
+echo $v | awk -Fx '{ print "resize -dx", $1+8, "-dy", $2+8 }' >/dev/wctl
+echo scroll >/dev/wctl
+vmx \
+	-d $d \
+	-M $M \
+	-m $m \
+	-n ea:$mac!$n \
+	-v vesa:$v \
+	$k \
+	$c $*
--- /dev/null
+++ b/bin/vncrio
@@ -1,0 +1,22 @@
+#!/bin/rc
+rfork nefs
+font=/lib/font/bit/uga.font
+bind -c $home/tmp /tmp
+bind -a $home/bin/rc /bin
+bind -a $home/bin/$cputype /bin
+test -f $home/p/rc/bindbins && . $home/p/rc/bindbins
+test -f $home/lib/ass){
+	auth/factotum
+	setec
+}
+webcookies
+webfs
+plumber
+echo accelerated 5 >'#m'/mousectl
+prompt=('; ' '	')
+rio -k '
+	window -r 586 0 1280 584 9grid
+	window -r 0 0 732 602 mw
+	window -scroll -r 0 324 612 806 ii
+	window -scroll -r 607 749 1280 800 girc /tmp/ircs/''#cat-v''
+'
--- /dev/null
+++ b/bin/w
@@ -1,0 +1,7 @@
+#!/bin/rc
+if(! ~ $#* 1){
+	echo $0 site
+	exit usage
+}
+hget http://wttr.in/~^$1^.png \
+	| page -w
--- /dev/null
+++ b/bin/wircrc
@@ -1,0 +1,315 @@
+#!/bin/rc
+wins=()
+cons=()
+server=irc.freenode.net
+port=6667
+tls=0
+pass=()
+srvpass=()
+chans=()
+realname='<nil>'
+nick=$user
+
+while (~ $1 -*) {
+	switch ($1) {
+	case -c
+		chans=`{echo $2 | sed 's/,/ /'}
+		shift
+	case -n
+		nick=$2
+		shift
+	case -p
+		port=$2
+		shift
+	case -r
+		realname=$2
+		shift
+	case -T
+		tls=1
+	case -*
+		echo 'usage: wircrc [-c chans] [-n nick] [-p port] [-r realname] [-T] [server]' >[1=2]
+		exit 'usage'	
+	}
+	shift
+}
+if(~ $#* 1)
+	server=$1
+
+bind '#|' /n/wircrc
+rfork en
+
+fn wmk {
+	id=$1
+	>/n/wircrc/data1 {
+		@{
+			rfork s
+			d=/n/wircrc.$id
+			p=`{cat /dev/ppid}
+			mount $wsys $d 'new -scroll -pid '^$p || exit
+			echo -n $id | tr -d \x0a >$d/label
+			echo wnew $id $d $p
+			if(! ~ $#* 1)
+				echo cmsg $id $*(2-)
+			<$d/cons {
+				while(line=`{read}){
+					~ $line '' || echo wtype $id $line
+				}
+			}
+		}
+		echo wclose $id
+	}
+	exit
+}
+
+fn etime {
+	date -t | sed 's/-//g;s/^..(.*)T(..):(..).*/\1:\2\3/'
+}
+
+fn wio {
+	if(~ $1 $wins){
+		d=wd$1
+		d=$$d
+		@{echo `{etime} $*(2-) | tee -a /tmp/irc.^$1 >$d/cons}
+	}
+}
+
+fn sio {
+	d=$1
+	if(~ $d *!*)
+		d=`{echo $d | awk -F'!' '{print $1}'}
+	if(~ $d $cons){
+		d=cd$d
+		d=$$d
+		@{echo $*(2-) >$d/data}
+		@{echo $*(2-) | sed -n 's/^PRIVMSG [^ ]+ :/'^`{etime}^' '^$nick^' ⇒ /p' >>/tmp/irc^.$1}
+	}
+}
+
+fn wctl {
+	if(~ $1 $wins){
+		d=wd$1
+		d=$$d
+		shift
+		@{echo $* >$d/wctl}
+	}
+}
+
+fn hangup {
+	if(~ $1 $cons){
+		d=cpid$1
+		d=$$d
+		@{echo kill >/proc/$d/notepg}
+	}
+}
+
+fn getkey {
+	a=`{auth/userpasswd 'server='^$1^' service=irc user='^$nick >[2]/dev/null}
+	if(~ $#a 2)
+		pass=$a(2)
+	a=`{auth/userpasswd 'server='^$1^' service=ircsrv user='^$nick >[2]/dev/null}
+	if(~ $#a 2)
+		srvpass=$a(2)
+	a=()
+}
+
+fn dial {
+	c=/n/wircrc.$1
+	bind '#|' $c
+	if(~ $2 1){
+		tlsclient $1 <>$c/data1 >[1=0] &
+	}
+	if not{
+		aux/trampoline $1 <>$c/data1 >[1=0] &
+	}
+	<>/$c/data >[1=0]{
+		$*(3-) $c $apid
+		exit
+	}
+}
+
+fn irc {
+	>[3]/n/wircrc/data1 {
+		echo cnew $* >[1=3]
+		tr -d '\x2\x8\xd\x1f' | @{
+			while(line=`{read}){
+				if(~ $line(1) PING)
+					echo PONG $line(2-)
+				if not {
+					line=`{echo $line | sed '
+s/^:([^!]+)[^ ]+ PRIVMSG (#[^ ]+)[^:]+:(.*)/cmsg '$1'!\2 \1 \3/g;
+s/^:([^!]+)[^ ]+ PRIVMSG :?([^ ]+)[^:]+:(.*)/cmsg '$1'!\1 \1 \3/g;
+s/^:([^!]+)[^ ]+ NOTICE \*[^:]+:(.*)/cmsg '$1' \1 \2/g;
+s/^:([^!]+)[^ ]+ NOTICE ([^ ]+)[^:]+:(.*)/cmsg '$1'!\1 \1 \3/g;
+s/^:([^!]+)[^ ]+ (KICK) (#[^ ]+) ([^ ]+:?)(.*)/xmsg '$1'!\3 \2 \1 \4 \5/g;
+s/^:([^!]+)[^ ]+ ([0-9]+)[^:]+:?(.*)/xmsg '$1' \2 \3/g;
+s/^:([^!]+)[^ ]+ (MODE|TOPIC) (#[^ ]+) :?(.*)/xmsg '$1'!\3 \2 \4/g;
+s/^:([^!]+)[^ ]+ (QUIT|NICK) :(.*)/xmsg '$1' \2 \1 \3/g;
+s/^:([^!]+)[^ ]+ (JOIN|PART) (#[^\ ]+).*/xmsg '$1'!\3 \2 \1/g;
+s/^:(.*) (PONG) [^ ]+[^:]+:(.*)/cmsg '$1'!\1 \1 \2/g;
+'}
+					~ $line '' || echo $line >[1=3]
+				}
+			}
+		}
+		echo cclose $1 >[1=3]
+	}
+}
+
+fn shutdown {
+	for(i in $cons)
+		hangup $i
+	for(i in $wins){
+		d=wp$i
+		d=$$d
+		@{echo hangup >/proc/$d/notepg} &
+	}
+	{}>/n/wircrc/data
+}
+
+fn sighup {
+	shutdown
+}
+
+fn sigint {
+	shutdown
+}
+
+wmk $server &
+dial tcp!$server!$port $tls irc $server &
+
+</n/wircrc/data {
+	while(a=`{read}){
+		id=$a(2)
+		switch($a(1)){
+		case cnew
+			cd$id=$a(3)
+			cpid$id=$a(4)
+			cons=($id $cons)
+			getkey $id
+			if(! ~ $#srvpass 0)
+				sio $id PASS $srvpass
+			sio $id USER $user foo bar :$realname
+			sio $id NICK $nick
+			if(! ~ $#pass 0)
+				sio $id nickserv identify $pass
+			pass=()
+			srvpass=()
+			for(i in $chans){
+				if(~ $i $id!'#'*){
+					wmk $i &
+					sio $id JOIN `{echo $i | awk -F'!' '{print $2}'}
+				}
+			}
+		case cclose
+			d=cd$id
+			$d=()
+			oids=$cons
+			cons=()
+			for(i in $oids){
+				if(! ~ $i $id)
+					cons=($i $cons)
+			}
+			for(i in $wins){
+				if(~ $i $id || ~ $i $id!*)
+					wio $i HUNGUP $id
+			}
+		case wnew
+			wd$id=$a(3)
+			wp$id=$a(4)
+			wins=($id $wins)
+			#wio $id '---' $id '---'
+		case wclose
+			d=wd$id
+			p=wp$id
+			unmount $$d
+			$d=()
+			$p=()
+			oids=$wins
+			wins=()
+			for(i in $oids){
+				if(! ~ $i $id)
+					wins=($i $wins)
+			}
+			if(~ $id $chans){
+				oids=$chans
+				chans=()
+				for(i in $oids){
+					if(! ~ $i $id)
+						chans=($i $chans)
+				}
+				sio $id PART `{echo $id | awk -F'!' '{print $2}'}
+			}
+		case xmsg
+			if(~ $id $wins)
+				wio $id $a(3-)
+			if not {
+				for(i in $wins){
+					if(~ $i $id!*)
+						wio $i $a(3-)
+				}
+			}
+		case cmsg
+			if(~ $id $wins)
+				wio $id $a(3) '⇒' $a(4-)
+			if not if(~ $id $wins2)
+				echo $a >/n/wircrc/data1
+			if not if(! ~ $id *!'#'*){
+				wmk $id $a(3-) &
+				wins2=($id $wins2)
+			}
+		case wtype
+			switch($a(3)){
+			case /x
+				shutdown
+			case /s
+				server=$a(4)
+				if(! ~ $server '' && ! ~ $server $cons){
+					if(! ~ $server $wins)
+						wmk $server &
+					if(~ $a(5) port)
+						port=$a(6)
+					dial tcp!$server!$port $tls irc $server &
+				}
+			case /j /t
+				target=$a(4)
+				server=`{echo $id | awk -F'!' '{print $1}'}
+				if(! ~ $target '' && ~ $server $cons){
+					id=$server!$target
+					if(~ $id $wins){
+						wctl $id unhide
+						wctl $id current
+					}
+					if not {
+						wmk $id &
+					}
+					if(~ $a(3) /j && ~ $target '#'*){
+						if(! ~ $id $chans){
+							chans=($id $chans)
+							sio $server JOIN $target
+						}
+					}
+				}
+			case /h
+				if(~ $a(4) $cons)
+					id=$a(4)
+				hangup `{echo $id | awk -F'!' '{print $1}'}
+			case /n
+				nick = $a(4)
+				server=`{echo $id | awk -F'!' '{print $1}'}
+				sio $server NICK $a(4)
+			case /p
+				server=`{echo $id | awk -F'!' '{print $1}'}
+				sio $server PING $server
+			case *
+				target=`{echo $id | awk -F'!' '{print $2}'}
+				if(~ $target '')
+					sio $id $a(3-)
+				if not {
+					a=$a(3-)
+					sio $id PRIVMSG $target ':'^$"a
+				}
+			}
+		}
+	}
+}
+shutdown
--- /dev/null
+++ b/bin/wl
@@ -1,0 +1,25 @@
+#!/bin/rc
+rfork n
+
+bind -b . /sys/games/lib/wl3d
+cd $home/lib/wl3d
+if(~ $1 -R){
+	r=(-dx $2 -dy $3)
+	shift 2
+}
+if not if(~ $#vgasize 0)
+	r=(-dx 328 -dy 208)
+if not
+	r=`{echo $vgasize |\
+		awk -Fx '{
+			a=$1/320;
+			b=$2/200;
+			c=int(b<a?b:a);
+			if(c*320 == $1 || c*200 == $2)
+				c--;
+			print "-dx", c*320+8, "-dy", c*200+8
+		}'
+	}
+
+echo resize $r >/dev/wctl
+wl3d $*
--- /dev/null
+++ b/bin/workspace
@@ -1,0 +1,12 @@
+#!/bin/rc
+if(! test -d $home/lib/work){
+	echo no work files
+	exit 'no work nor worry'
+}
+. /tmp/sizes
+for(i in $home/lib/work/*){
+	window -hide -r $briorect $i
+	sleep 2
+	last=`{cd /dev/wsys; ls | sort -n | tail -1}
+	echo -n `{basename $i} >/dev/wsys/$last/label
+}
--- /dev/null
+++ b/bin/wpa
@@ -1,0 +1,6 @@
+#!/bin/rc -e
+ip/ipconfig unbind || status=''
+if(! test -d /net/ether1)
+	bind -a '#l1' /net
+aux/wpa -s $1 /net/ether1
+ip/ipconfig ether /net/ether1
--- /dev/null
+++ b/bin/ya
@@ -1,0 +1,9 @@
+#!/bin/rc
+# easiest way, low quality
+if(! ~ $#* 1){
+	echo usage $0 videoid
+	exit usage
+}
+nvi -A 251 -a /fd/1 $"1 |\
+	mcfs -t audio |\
+	audio/opusdec
--- /dev/null
+++ b/bin/yv
@@ -1,0 +1,9 @@
+#!/bin/rc
+# easiest way, low quality
+if(! ~ $#* 1){
+	echo usage $0 videoid
+	exit usage
+}
+nvi -V 18 -v /tmp/vid.mp4 $"1 \
+	&& treason /tmp/vid.mp4 \
+	&& rm /tmp/vid.mp4
--- /dev/null
+++ b/bin/z
@@ -1,0 +1,4 @@
+#!/bin/rc
+rfork n
+theme=$home/lib/theme/dicks
+audio/mkplist $* >[2]/dev/null | audio/zuke -cpD
--- /dev/null
+++ b/bin/z2
@@ -1,0 +1,4 @@
+#!/bin/rc
+list=$1
+shift
+theme=$home/lib/theme/dicks audio/zuke -cpD $* <$list
--- /dev/null
+++ b/bin/übung
@@ -1,0 +1,53 @@
+#!/bin/rc
+
+# FIXME: alternatives/synonyms: don't fail because of those
+# FIXME: examples, phrases
+# FIXME: verb conjugation
+# FIXME: meaning alternatives
+# FIXME: noun genders, plural, derivatives/compounds
+# FIXME: shuffle list every time it's parsed completely
+# FIXME: randomly ask english or german
+
+en=0
+files=$home/p/not/ger/^(adj adv cnj exp itj nou prn prp vrb)
+score=0
+total=0
+
+fn sigint{
+	echo; echo deine Endsumme: $score/$total Punkte, pfff.
+	e
+	exit ''
+}
+
+fn chk{
+	a=$2
+	b=$1
+	if(~ $en 1){
+		a=$1
+		b=$2
+	}
+	echo -n was ist $a?'		'
+	if(! ~ `{read -n 1} $b)
+		echo NEIN! es ist $b!
+	if not
+		score=`{echo $score | awk '{print $1+1}'}
+	total=`{echo $total | awk '{print $1+1}'}
+}
+
+while(~ $1 -*){
+	switch($1){
+	case -e
+		en=1
+	}
+	shift
+}
+
+ifs='
+' l=(`{cat $files \
+	| sed '/^	/d;/^$/d;s/		*/	/g' \
+	| awk -F '	' 'BEGIN{srand()}{printf "%06d  %s\n", rand()*1000000, $0;}' \
+	| sort -n \
+	| sed 's/^[0-9]*  //'})
+while()
+	for(i in $l)
+		chk `{echo $i | awk -F '	' '{printf "%s\n%s", $1, $2}'}
--- a/bindbins
+++ /dev/null
@@ -1,18 +1,0 @@
-#!/bin/rc
-if(test -d $home/p/rc)
-	bind -a $home/p/rc/bin /bin
-if(test -d $home/p/rc2)
-	bind -a $home/p/rc2/bin /bin
-if(test -d $home/p/pico)
-	touch $home/bin/rc/pico && bind $home/p/pico/pico $home/bin/rc/pico
-if(test -d $home/p/sm2/bin)
-	bind -a $home/p/sm2/bin /bin
-if(test -d $home/p/notes/bin)
-	bind -a $home/p/notes/bin /bin
-if(test -d /sys/lib/go/amd64-1.15.2/bin)
-	bind -a /sys/lib/go/amd64-1.15.2/bin /bin
-if(test -f $home/p/rc/fn)
-	. $home/p/rc/fn
-
-#if(test -d $home/p/sm2/lib)
-#	bind -ac $home/p/sm2/lib /lib
--- a/br
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/rc
-# SBLC_PWM_CTL2: bytes 15:0, range 0 (off) to v>>16 (full)
-
-if(! ~ $#* 1){
-	echo usage: $0 factor
-	exit 'usage'
-}
-v=`{seg -Lr igfxmmio 0x400000 0xc8254}
-if(~ $#v 0)
-	exit 'no such named segment'
-v=`{echo 'v='$v'; v & ~0xffff | ((v>>16) / '$1')' | pc -n}
-if(! ~ $#v 1)
-	exit 'invalid factor'
-seg -Lw igfxmmio 0x400000 0xc8254 $v
--- a/cex
+++ /dev/null
@@ -1,26 +1,0 @@
-#!/bin/awk -f
-function q(){
-	o = 1 + int(rand() * 10 % 4)
-	a = 1 + int(rand() * (o==4 ? 1000 : 100))
-	b = 1 + int(rand() * 100)
-	r = o==1 ? a + b\
-		: o==2 ? a - b\
-		: o==3 ? a * b\
-		: a / b	# equality works... sometimes? rounding errors?
-	print a, op[o], b
-}
-BEGIN{
-	op[1] = "+"
-	op[2] = "-"
-	op[3] = "*"
-	op[4] = "/"
-	srand()
-	q()
-}
-{
-	if($1 != r){
-		print "NEIN NEIN NEIN!  " r
-		system("theo")
-	}
-	q()
-}
--- a/chat
+++ /dev/null
@@ -1,108 +1,0 @@
-#!/bin/rc
-# minimal chat client for hubfs: chat [-n NICK] [-j CHANNEL] [chatsrv]
-# dd -bs `{du -n /n/chat/chat | sed 's/ .*//'} -skip 1 -if /n/chat/chat
-rfork enf
-
-fn helpmessage{
-	echo -------------------------
-	echo '/q to quit  |  /c to list channels  |  /h for help message'
-	echo '/n NICK to change nick  |  /j CHANNEL to change channels'
-	echo -------------------------
-}
-
-fn close{
-	#echo PART $name from $channel >>/n/$chatsrv/$channel
-	@{echo kill>/proc/$catkill/ctl}
-}
-
-fn shutdown{
-	close
-	exit
-}
-
-fn sighup{
-	shutdown
-}
-
-fn sigint{
-	shutdown
-}
-
-channel=chat
-chatsrv=chat
-while (~ $1 -*){
-	switch($1){
-	case -n
-		name = $2
-		shift 2
-	case -j
-		channel = $2
-		shift 2
-	case *
-		echo bad flag $1 '-n NICK -j CHANNEL'
-		shift
-	}
-}
-if(! ~ $1 '')
-	chatsrv=$1
-if(! test -e /n/$chatsrv/chat)
-	mount /srv/$chatsrv /n/$chatsrv
-if(! test -e /n/$chatsrv/chat){
-	echo 'no chat service named $chatsrv found' >[1=2]
-	exit no.chat
-}
-
-echo '		-- hubchat 0.2 --'
-helpmessage
-sleep 2
-while(~ $#name 0){
-	echo 'please enter a chat name:'
-	name=`{read}
-}
-#echo JOIN $name to $channel >>/n/$chatsrv/$channel
-#grep -bv '^BurnZeZ :  ' /n/$chatsrv/$channel &
-cat /n/$chatsrv/$channel &
-catkill=$apid
-
-while(talk=`{read}){
-	switch($talk(1)){
-	case /q
-		shutdown
-	case /n
-		if(! ~ $talk(2) ''){
-			echo nick $name ' -> ' $talk(2) >>/n/$chatsrv/$channel
-			name=$talk(2)
-		}
-		if not
-			echo 'you need to provide a nick for /n NICK'
-	case /j
-		if (~ $talk(2) '')
-			echo must specify a channel to join
-		if not if(test -e /n/chat/$talk(2)){
-			close
-			channel=$talk(2)
-			cat /n/chat/$channel &
-			catkill=$apid
-			echo JOIN $name to $channel >>/n/$chatsrv/$channel
-		}
-		if not
-			echo channel does not exist
-	case /h
-		helpmessage
-		echo currently in $channel
-		echo
-	case /c
-		echo Available channels:
-		lc /n/$chatsrv
-		echo -------------------
-		echo currently in $channel
-		echo
-	case *
-#		ts=`{date -u}
-#		ts=`{echo '('^$ts(4)^')'}
-		if(! ~ $talk ''){
-			line=`{echo $name '→ ' $talk}
-			echo $line >>/n/chat/$channel
-		}
-	}
-}
--- a/chord
+++ /dev/null
@@ -1,10 +1,0 @@
-#!/bin/rc
-rfork n
-games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null || exit
-cat <<! | mst | games/dmid | games/opl3 | norm 5 | pplay
-t $1
-4 0c♭3 0e♭3 0g♭3
-4 0c♭3 0e♭3 0g♭3
-4 0c♭3 0e♭3 0g♭3
-4 0c♭3 0e♭3 0g♭3
-!
--- a/cinrio
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/rc -e
-truetypefs
-font=/n/ttf/unifont.ttf.16/font
-plumber
-rio
-unmount /mnt/plumb
--- a/cpurio
+++ /dev/null
@@ -1,34 +1,0 @@
-#!/bin/rc
-if(! ~ $sysname aib && ~ `{ns | grep '#v'} ''){
-	screenrc
-	echo softscreen off >'#v/vgactl'
-	echo hwaccel on >'#v/vgactl'
-}
-rfork efns	# weeeee
-font=/lib/font/bit/uga.font
-bind -a '#A' /dev
-bind -c $home/tmp /tmp
-bind -a $home/bin/rc /bin
-bind -a $home/bin/$cputype /bin
-test -f $home/p/rc/bindbins && . $home/p/rc/bindbins
-test -f $home/lib/ass){
-	auth/factotum
-	setec
-}
-webcookies
-webfs
-plumber
-switch($sysname){
-case w500
-	echo pin 22 >'#A'/audioctl
-	echo inpin 23 >'#A'/audioctl
-case hsw
-	echo pin 27 >'#A/audioctl'
-	echo inpin 25 >'#A'/audioctl
-}
-if(! ~ $sysname aib)
-	echo master 40 >'#A/volume'
-echo accelerated 3 >'#m'/mousectl
-prompt=('; ' '	')
-rio -i riostart
-# might be nice to do dontkill '^(rio|rc)$'
--- a/dmlotr
+++ /dev/null
@@ -1,13 +1,0 @@
-#!/bin/rc -xe
-t=/tmp/dmlotr.$pid
-f='http://www.shamusyoung.com/twentysidedtale/?p=612'
-while(){
-	hget $f | sed 's/[<>]/\n/g' >$t
-	for(i in `{sed -n 's/.*img src=''(http.*\/images\/[^'']+)''.*/\1/p' $t})
-		dw $i
-	f=`{sed -n 's/.*a href="(http[^\?]+\?p=[^"]+)".*/\1/p' $t | sed -n '5{p;q;}'}
-	if(~ $#f 0){
-		rm $t
-		exit
-	}
-}
--- a/dmus.mp3
+++ /dev/null
@@ -1,94 +1,0 @@
-#!/bin/rc
-# this overrides music in final doom and any custom music in pwads, since the
-# labels are hardcoded in the source.
-switch($2){
-	case adrian
-		f=$home/m/doom2.adrians.asleep.mp3
-	case ampie
-		f=$home/m/doom2.bye.bye.american.pie.mp3
-	case betwee
-		f=$home/m/doom2.between.levels.mp3
-	case bunny
-		f=$home/m/doom.bunny.mp3
-	case countd count2
-		f=$home/m/doom2.countdown.to.death.mp3
-	case dead dead2
-		f=$home/m/doom2.the.demons.dead.mp3
-	case dm2ttl
-		f=$home/m/doom2.intro.mp3
-	case dm2int
-		f=$home/m/doom2.intermission.mp3
-	case doom doom2
-		f=$home/m/doom2.doom.mp3
-	case ddtblu ddtbl2 ddtbl3
-		f=$home/m/doom2.the.dave.d.taylor.blues.mp3
-	case e1m1
-		f=$home/m/doom.at.dooms.gate.mp3
-	case e1m2
-		f=$home/m/doom.the.imps.song.mp3
-	case e1m3
-		f=$home/m/doom.dark.halls.mp3
-	case e1m4
-		f=$home/m/doom.kitchen.ace.and.taking.names.mp3
-	case e1m5
-		f=$home/m/doom.suspense.mp3
-	case e1m6 e3m6
-		f=$home/m/doom.on.the.hunt.mp3
-	case e1m7 e2m5 e3m5
-		f=$home/m/doom.demons.on.the.prey.mp3
-	case e1m8 e3m4
-		f=$home/m/doom.sign.of.evil.mp3
-	case e1m9 e3m9
-		f=$home/m/doom.hiding.the.secrets.mp3
-	case e2m1
-		f=$home/m/doom.i.sawed.the.demons.mp3
-	case e2m2
-		f=$home/m/doom.the.demons.from.adrians.pen.mp3
-	case e2m3 inter
-		f=$home/m/doom.intermission.from.doom.mp3
-	case e2m4
-		f=$home/m/doom.theyre.going.to.get.you.mp3
-	case e2m6
-		f=$home/m/doom.sinister.mp3
-	case e2m7 e3m7
-		f=$home/m/doom.waltz.of.the.demons.mp3
-	case e2m8
-		f=$home/m/doom.nobody.told.me.about.id.mp3
-	case e2m9 e3m1
-		f=$home/m/doom.untitled.mp3
-	case e3m2
-		f=$home/m/doom.donna.to.the.rescue.mp3
-	case e3m3
-		f=$home/m/doom.deep.into.the.code.mp3
-	case e3m8
-		f=$home/m/doom.facing.the.spider.mp3
-	case evil
-		f=$home/m/doom2.evil.incarnate.mp3
-	case in_cit
-		f=$home/m/doom2.into.sandys.city.mp3
-	case intro
-		f=$home/m/doom.title.mp3
-	case messag messg2
-		f=$home/m/doom2.message.from.the.archvile.mp3
-	case openin
-		f=$home/m/doom2.opening.to.hell.mp3
-	case read_m
-		f=$home/m/doom2.end.mp3
-	case romero romer2
-		f=$home/m/doom2.waiting.for.romero.to.play.mp3
-	case runnin runni2
-		f=$home/m/doom2.running.from.evil.mp3
-	case shawn shawn2 shawn3
-		f=$home/m/doom2.shawns.got.the.shotgun.mp3
-	case stalks stlks2 stlks3
-		f=$home/m/doom2.the.healer.stalks.mp3
-	case tense
-		f=$home/m/doom2.getting.too.tense.mp3
-	case the_da theda2 theda3
-		f=$home/m/doom2.in.the.dark.mp3
-	case ultima
-		f=$home/m/doom2.the.ultimate.challenge.mp3
-	case victor
-		f=$home/m/doom.victor.mp3
-	}
-audio/mp3dec <$f
--- a/doom
+++ /dev/null
@@ -1,58 +1,0 @@
-#!/bin/rc -e
-# set up namespace for a particular version of doom and launch it
-# default setup:
-# - $home/lib/doom: mntpt and location of config file
-# - $home/lib/doom/$game: user game directories: savegames and screenshots
-# - /sys/games/lib/doom/$game: system iwad and pwad directories
-# cwd is bound over $mntpt to allow loading stuff from there
-# example: launch doom2 with scythe.wad (both in /sys/games/lib/doom/d2)
-#	; doom d2 -file scythe.wad
-# example game version names:
-# doom.wad → /sys/games/lib/doom/d1/
-# doom2.wad → /sys/games/lib/doom/d2/
-# doom2f.wad → /sys/games/lib/doom/d2f/
-# doom1.wad → /sys/games/lib/doom/dsh/
-# plutonia.wad → /sys/games/lib/doom/plt/
-# tnt.wad → /sys/games/lib/doom/tnt/
-# doomu.wad → /sys/games/lib/doom/ud/
-
-rfork ne
-flagfmt='b,l,z,m mntpt'
-args='game [params]'
-if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
-	aux/usage
-	exit usage
-}
-mntpt=$home/lib/doom
-if(~ $#flagm 1)
-	mntpt=$flagm
-if(! test -d $mntpt/$1)
-	mkdir -p $mntpt/$1
-bind -ac $mntpt/$1 $mntpt
-if(test -d /sys/games/lib/doom/$1)
-	bind -a /sys/games/lib/doom/$1 $mntpt
-if(! ~ $flagb 1)
-	bind -b `{pwd} $mntpt
-cd $mntpt
-
-# max scaling factor is 4 unless doom itself is patched
-if(~ $#vgasize 0 || ~ $flagz 1)
-	r=(-dx 328 -dy 208)
-if not
-	r=`{echo $vgasize |\
-		awk -Fx '{
-			a=$1/320;
-			b=$2/200;
-			c=int(b<a?b:a);
-			if(c*320 == $1 || c*200 == $2)
-				c--;
-			print "-dx", c*320+8, "-dy", c*200+8
-		}'
-	}
-if(! ~ $flagz 1)
-	echo resize $r >/dev/wctl
-
-if(! ~ $flagl 1)
-	games/doom $* >/dev/null
-if not
-	games/doom $* >/tmp/doomlog.$pid >[2=1]
--- a/dp
+++ /dev/null
@@ -1,7 +1,0 @@
-#!/bin/rc
-
-audio/pcmconv -i u32r1c1 -o U32r1c1 <$home/dport*.bin >/dev/pl
-mkdir '#g'/fb
-echo 'va 0x40000000 0x10000000 fixed' > '#g'/fb/ctl
-@{ rfork n; run >/dev/null; bind -b '#i' /dev }	# ?
-
--- a/dpal
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/rc
-# convert selected playpal palette to spred(1) format
-# FIXME: includes garbage past the end
-pn=0
-while(~ $1 -n){
-	pn=$2
-	shift 2
-}
-echo pal 256
-dd -bs 768 -skip $pn -count 1 <$1 >[2]/dev/null \
-	| xd -1x \
-	| ssam '
-,s/^....... +//g
-s/\n/ /g
-s/(..) (..) (..) /0x\1\2\3\n/g
-'
--- a/duck
+++ /dev/null
@@ -1,3 +1,0 @@
-#!/bin/rc
-#plumb -d web 'http://duckduckgo.com/lite'
-mothra 'http://duckduckgo.com/lite'
--- a/dw
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc
-if(~ $1 -o){
-	of=1
-	shift
-}
-for(i in $*){
-	f=`{echo $i | sed -n 's,.*/([^/]+)$,\1,p'}
-	if(! ~ $#of 0 || ! test -e $f)
-		echo $f'
-'$i
-} | xargs -n 2 -p 10 hget -o
--- a/edit
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-B /dev/wsys/`{sed 's/[ 	]+//g' /dev/winid}^/text
--- a/eth0
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-ip/ipconfig ether /net/ether1 unbind
-Kill wpa | rc
-ip/ipconfig ether /net/ether0
--- a/fpl
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/rc
-ps -n | awk '
-/ play$/ { g[++i] = $3 }
-{ for(n=1; n<=i; n++) if(g[n] == $3) p[n] = $2 }
-END { for(n=1; n<=i; n++) print p[n] }
-'
--- a/frequenzbohrer
+++ /dev/null
@@ -1,86 +1,0 @@
-#!/bin/awk -f
-# ; mkdir $home/mid
-# ; for(i in $notestringsbelow) echo 2 0^$i | mst | games/midi -c > $home/mid/^$i^.pcm
-
-function extant(v, a){
-	for(e in a)
-		if(a[e] == v)
-			return 1
-	return 0
-}
-
-function addrange(n){
-	i = length(roster) + 1
-	for(o in range){
-		m = n + range[o]
-		if(m > 0 && m <= length(note) && !extant(m, roster))
-			roster[i++] = m
-	}
-}
-
-function new(){
-	print "Find die noten, allied schweinhund!"
-	for(i in qs){
-		do
-			n = int(rand() * 10000000 % length(roster) + 1)
-		while(extant(roster[n], qs))
-		qs[i] = roster[n]
-	}
-	for(i in keys)
-		qs[int(rand() * 10000000 % length(qs) + 1)] = keys[i]
-	cmd = "cat $home/mid/^("
-	for(i=1; i<=length(qs); i++)
-		cmd = cmd note[qs[i]] ".pcm "
-	cmd = cmd ") >/dev/audio"
-	system(cmd)
-}
-
-BEGIN{
-	split("\
-c0 c♯0 d0 d♯0 e0 f0 f♯0 g0 g♯0 a0 a♯0 b0 \
-c1 c♯1 d1 d♯1 e1 f1 f♯1 g1 g♯1 a1 a♯1 b1 \
-c2 c♯2 d2 d♯2 e2 f2 f♯2 g2 g♯2 a2 a♯2 b2 \
-c3 c♯3 d3 d♯3 e3 f3 f♯3 g3 g♯3 a3 a♯3 b3 \
-c4 c♯4 d4 d♯4 e4 f4 f♯4 g4 g♯4 a4 a♯4 b4 \
-c5 c♯5 d5 d♯5 e5 f5 f♯5 g5 g♯5 a5 a♯5 b5 \
-c6 c♯6 d6 d♯6 e6 f6 f♯6 g6 g♯6 a6 a♯6 b6 \
-c7 c♯7 d7 d♯7 e7 f7 f♯7 g7 g♯7 a7 a♯7 b7 \
-c8 c♯8 d8 d♯8 e8 f8 f♯8 g8 g♯8 a8 a♯8 b8 \
-c9 c♯9 d9 d♯9 e9 f9 f♯9 g9 g♯9 a9 a♯9 b9 \
-c10 c♯10 d10 d♯10 e10 f10 f♯10 g10", note)
-	# FIXME: just have all notes from octaves -1,0,+1
-	split("-12 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 12 1 2 3 4 5 6 7 8 9 10 11", range)
-	srand()
-	print "Vich noten shall wir testen diese day, bastard?"
-}
-NR == 1{
-	n = split($0, keys)
-	if(n < 1)
-		exit("no notes to hand")
-	for(k in keys){
-		m = 0
-		for(n in note){
-			if(keys[k] == note[n]){
-				m = n
-				break
-			}
-		}
-		if(m == 0){
-			print "unknown note " keys[k]
-			exit("unknown note " keys[k])
-		}
-		keys[k] = m
-		addrange(m)
-	}
-	for(i=1; i<=6*length(keys); i++)
-		qs[i] = 0
-	new()
-}
-NR > 1{
-	# FIXME: just choose one of the notes at random; only test one note;
-	# say which one it's testing
-	for(i=1; i<=NF; i++)
-		if(!($i in qs) || !extant(qs[$i], keys))
-			print "NEIN!  Es ist " note[qs[$i]] "!"
-	new()
-}
--- a/gba
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/240;
-		b=$2/160;
-		c=int(b<a?b:a);
-		if(c*240 == $1 || c*160 == $2)
-			c--;
-		print "-dx", c*240+8, "-dy", c*160+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/gba -a $*(3-) || games/gba $*(3-)}
-if not
-	games/gba -a $* || games/gba $*
--- a/gbc
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc -e
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/160;
-		b=$2/144;
-		c=int(b<a?b:a);
-		if(c*160 == $1 || c*144 == $2)
-			c--;
-		print "-dx", c*160+8, "-dy", c*144+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/gb -a $*(3-) || games/gb $*(3-)}
-if not
-	games/gb -a $* || games/gb $*
--- a/genpw
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/rc
-n=32
-if(~ $1 -n){
-	n=$2
-	shift 2
-}
-tr -cd ' '-~ </dev/random | read -c $n
-echo
--- a/gridreg
+++ /dev/null
@@ -1,13 +1,0 @@
-#!/bin/rc
-rfork n
-srv tcp!registry.9p.zone!registry registry /mnt/registry
-rm /srv/registry
-cd /mnt/registry
->new{
-	echo tcp!9dump!9fs description '''read-only file dump''' contact qwx@sciops.net type fileserver
-	tail -f event
-} &
->new{
-	echo tcp!9dump!t9fs description '''tls 9dump, ask for credentials''' contact qwx@sciops.net type fileserver
-	tail -f event
-}
--- a/imfdec
+++ /dev/null
@@ -1,27 +1,0 @@
-#!/bin/rc
-rate=49716
-norm=()
-bareimf=()
-while(~ $1 -?){
-	switch($1){
-	case -r
-		rate=$2
-		shift
-	case -f
-		norm=$2
-		shift
-	case -n
-		bareimf=1
-	case *
-		echo usage: $0 '[-n] [-r rate] [-f norm]'
-		exit usage
-	}
-	shift
-}
-cmd=(opl2 -r $rate)
-if(~ $#bareimf 0)
-	cmd=(imf '|' $cmd)
-if(! ~ $#norm 0)
-	cmd=($cmd '|' norm $norm)
-echo $cmd
-eval $cmd
--- a/joygba
+++ /dev/null
@@ -1,37 +1,0 @@
-#!/bin/rc
-# run as "nusb/joy epX.Y | joygba"
-
-awk -safe '
-	BEGIN { k[0] = "" }
-
-	/^axis 0 0/   { k[0] = "left " }
-	/^axis 0 255/ { k[0] = "right " }
-	/^axis 0 128/ { k[0] = "" }
-
-	/^axis 1 0/   { k[1] = "up " }
-	/^axis 1 255/ { k[1] = "down " }
-	/^axis 1 128/ { k[1] = "" }
-
-	/^down 1$/ { k[3] = "b " }
-	/^down 5$/ { k[2] = "a " }
-	/^down 6$/ { k[8] = "x " }
-	/^down 2$/ { k[9] = "y " }
-	/^down 3$/ { k[4] = "control " }
-	/^down 4$/ { k[5] = "start " }
-	/^down 7$/ { k[6] = "l1 " }
-	/^down 8$/ { k[7] = "r1 " }
-
-	/^up 1$/ { k[3] = "" }
-	/^up 5$/ { k[2] = "" }
-	/^up 6$/ { k[8] = "" }
-	/^up 2$/ { k[9] = "" }
-	/^up 3$/ { k[4] = "" }
-	/^up 4$/ { k[5] = "" }
-	/^up 7$/ { k[6] = "" }
-	/^up 8$/ { k[7] = "" }
-
-	{
-		print k[0] k[1] k[2] k[3] k[4] k[5] k[6] k[7] k[8] k[9]
-		fflush
-	}
-'
--- a/joygba2
+++ /dev/null
@@ -1,37 +1,0 @@
-#!/bin/rc
-# run as "nusb/joy epX.Y | joygba"
-
-awk -safe '
-	BEGIN { k[0] = "" }
-
-	/^axis 0 0/   { k[0] = "left " }
-	/^axis 0 255/ { k[0] = "right " }
-	/^axis 0 128/ { k[0] = "" }
-
-	/^axis 1 0/   { k[1] = "up " }
-	/^axis 1 255/ { k[1] = "down " }
-	/^axis 1 128/ { k[1] = "" }
-
-	/^down 2$/ { k[3] = "b " }
-	/^down 1$/ { k[2] = "a " }
-	/^down 3$/ { k[8] = "x " }
-	/^down 4$/ { k[9] = "y " }
-	/^down 7$/ { k[4] = "control " }
-	/^down 8$/ { k[5] = "start " }
-	/^down 5$/ { k[6] = "l1 " }
-	/^down 6$/ { k[7] = "r1 " }
-
-	/^up 2$/ { k[3] = "" }
-	/^up 1$/ { k[2] = "" }
-	/^up 3$/ { k[8] = "" }
-	/^up 4$/ { k[9] = "" }
-	/^up 7$/ { k[4] = "" }
-	/^up 8$/ { k[5] = "" }
-	/^up 5$/ { k[6] = "" }
-	/^up 6$/ { k[7] = "" }
-
-	{
-		print k[0] k[1] k[2] k[3] k[4] k[5] k[6] k[7] k[8] k[9]
-		fflush
-	}
-'
--- a/joynes
+++ /dev/null
@@ -1,33 +1,0 @@
-#!/bin/rc
-# run as "nusb/joy epX.Y | joynes N", where N=[1,2]
-
-awk -safe -v 'joy='joy$1 '
-	BEGIN { k[0] = "" }
-
-	/^axis 0 0/   { k[0] = "left " }
-	/^axis 0 255/ { k[0] = "right " }
-	/^axis 0 128/ { k[0] = "" }
-
-	/^axis 1 0/   { k[1] = "up " }
-	/^axis 1 255/ { k[1] = "down " }
-	/^axis 1 128/ { k[1] = "" }
-
-	/^down 2$/ { k[3] = "b " }
-	/^down 1$/ { k[2] = "a " }
-	#/^down 3$/ { k[4] = "control " }
-	#/^down 4$/ { k[5] = "start " }
-	/^down 7$/ { k[4] = "control " }
-	/^down 8$/ { k[5] = "start " }
-
-	/^up 2$/ { k[3] = "" }
-	/^up 1$/ { k[2] = "" }
-	#/^up 3$/ { k[4] = "" }
-	#/^up 4$/ { k[5] = "" }
-	/^up 7$/ { k[4] = "" }
-	/^up 8$/ { k[5] = "" }
-
-	{
-		print joy " " k[0] k[1] k[2] k[3] k[4] k[5]
-		fflush
-	}
-'
--- a/khinmidi
+++ /dev/null
@@ -1,12 +1,0 @@
-#!/bin/rc
-flag e +
-
-for(i in $*){
-	x=`{echo $i | sed -n 's/.*\/([^\/]+)$/\1/p'}
-	mkdir -p $x && cd $x
-	hget $i |\
-		sed -n '/\.mid/s/^.*<a href="(.*)".*/\1/p' |\
-		uniq |\
-		xargs dw
-	cd ..
-}
--- a/khinsider
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/rc
-flag e +
-
-for(i in $*){
-	x=`{echo $i | sed -n 's/.*\/([^\/]+)$/\1/p'}
-	mkdir -p $x && cd $x
-	hget $i |\
-		sed -n '/\.mp3/s/^.*<a href="(.*)".*/\1/p' |\
-		uniq |\
-		xargs -n 1 hget |\
-		sed -n '/^<audio/s/<audio id=".*" src="(.*\.mp3)".*/\1/p' |\
-		xargs dw
-		cd ..
-}
--- a/lofi
+++ /dev/null
@@ -1,3 +1,0 @@
-#!/bin/rc
-play -o /fd/1 >[2]/dev/null |\
-	audio/opusenc --music --downmix-stereo --bitrate 64
--- a/md
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/320;
-		b=$2/224;
-		c=int(b<a?b:a);
-		if(c*320 == $1 || c*224 == $2)
-			c--;
-		print "-dx", c*320+8, "-dy", c*224+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/md -a $*(3-) || games/md $*(3-)}
-if not
-	games/md -a $* || games/md $*
--- a/metro
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc
-rfork n
-games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null || exit
-cat <<! | mst | games/dmid | games/opl3 | pplay
-t $1
-i 0 127
-4 0c5
-4 0c5
-4 0c5
-4 0c5
-!
--- a/mfmt
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/rc
-pref=$1
-fmt=$2
-sed \
-	$pref^'
-	s/^''//
-	s/''$//
-	s/[\[\]\!,\(\)''\$\*\?:\;=\}\{`]//g
-	s/#/♯/g
-	s/\&/and/g
-	s/( - | |_)/./g
-	s/\.[^\.]+$/.'^$fmt^'/
-	s/ /./g
-	s/\.\.+/./g
-' |\
-	tr A-ZА-Я a-zа-я
--- a/mk9
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/rc -ex
-9fs 9fat
-if(test -f /n/9fat/9pc64 || test -f /n/9fat/9pc){
-	rm /n/9fat/9bootfat
-	cp /386/9bootfat /n/9fat/
-	chmod +al /n/9fat/9bootfat
-}
-if(test -f /n/9fat/9pc64)
-	cp /amd64/9pc64 /n/9fat/
-if(test -f /n/9fat/9pc)
-	cp /386/9pc /n/9fat/
-if(test -f /n/9fat/9zynq)
-	cp /arm/9zynq /n/9fat/
-rm /srv/dos
-unmount /n/9fat
-unmount /n/9
--- a/mkall
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc -e
-for(i in amd64 386 arm){
-	if(! ~ $#* 0)
-		objtype=$i mk $*^.install
-	if not
-		objtype=$i mk install
-}
-if(! ~ $#* 0)
-	mk $*^.clean
-if not
-	mk clean
--- a/mkcp
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-disk/mkfs -z 4096 -s $1 -d $*(2-) /sys/lib/sysconfig/proto/allproto
--- a/mkradio
+++ /dev/null
@@ -1,12 +1,0 @@
-#!/bin/rc
-rfork n
-rimport -C -c -u share aib /usr/share /n/share || exit rimport
-if(! ~ $#* 0)
-	t=$1
-if not
-	t=`{walk -demn /n/share/radio}
-cd $home/m
-for(i in `{walk -emn | awk '{if($1 > '^$t(1)^') print $2}'}){
-	echo $i
-	lofi <$i >/n/share/radio/$i
-}
--- a/mku
+++ /dev/null
@@ -1,170 +1,0 @@
-#!/bin/rc -xe
-# gottagofast update script
-# FIXME: this script is FUCKING RETARDED
-# FIXME: idea: don't rfork n, allow fixing whatever and continuing build; better
-# error detection and recovery
-rfork en
-h=$home
-
-fn mkp{
-	cd $h/p
-	mk nuke
-	mk install && mk nuke || exit NOPE
-	cp -x opl2/man/1/opl2 pplay/man/1/pplay u6/man/1/u6mopl wl3d/man/1/wl3d /sys/man/1/
-	cp -x wl3d/man/6/wl3d /sys/man/6/
-	cd $h/p/qk2
-	for(i in mkfile.*){
-		bind $i mkfile
-		mk install && mk nuke || exit NOPE
-		unmount mkfile
-	}
-	for(i in spew/aplay ftrvxmtrx/imgtools ftrvxmtrx/mp3dec){
-		if(test -d $h/lib/extra/$i){
-			cd $h/lib/extra/$i
-			mk install && mk clean
-		}
-	}
-}
-
-if(! test -e $h/p){
-	h=/usr/qwx
-	if(! test -e $h/p)
-		exit 'no p to hand'
-}
-
-{
-cd /
-bind -ac /dist/plan9front /
-hg revert --no-backup \
-	/lib/vgadb\
-	/rc/bin/^(9fs ircrc play)\
-	/sys/lib/plumb/basic\
-	/sys/lib/kbmap\
-	/sys/man/1/audio\
-	/sys/man/4/nusb\
-	/sys/src/9/pc64/mkfile\
-
-sysupdate
-. /sys/lib/rootstub
-ramfs -um /n/mk
-@{cd /sys/src; tar c *} | @{cd /n/mk; tar x}
-bind /n/mk /sys/src
-
-#fplot-col\
-#life-col.patch\	FIXME: goddamnit burnzez
-colf=(\
-acme-col\
-kbmap-col\
-libdraw-menucol\
-colors-col\
-faces-col\
-samterm-col\
-spred-col\
-stats-col\
-statusmsg-col\
-statusbar-col\
-sudoku-col\
-mothra-col\
-vt-col\
-zuke-col\
-)
-
-f=(\
-9fs-9paste\
-9nusbrc-nesusbjoy\
-doom-autorun\
-doom-chat\
-doom-limits\
-doom-mouseglitches\
-doom-mousegrab\
-doom-naivescaleup\
-doom-nodclick\
-doom-skywallhit\
-doom-spy\
-doom-udpip\
-file-mod\
-file-opus\
-ircrc-jpmfix\
-ircrc-print-log\
-kbdfs-fshalt\
-libplumb-basic\
-man1audio-opus\
-man-joy\
-mothra-font\
-page-invert\
-paint-reverse\
-play-dmid-mod\
-play-opus\
-png-maxmem\
-rio-exit\
-sam-fullfrontalnudity\
-samterm-fullfrontalnudity\
-samterm-flayers\
-troff-nchars\
-)
-
-ko=(amd64 386)
-k=(pc64 pc)
-switch($sysname){
-case hsw aib x220 t61p w520 u32
-	f=($f $colf)
-	ko=(amd64 386 arm)
-	k=(zynq pc pc64)
-case t61 t61p2 t60p w500
-	f=($f $colf)
-case ibm3000 t43
-	f=($f $colf)
-	ko=386
-	k=(pc)
-case *
-	ko=386
-	k=(pc)
-}
-for(i in $h/lib/extra/ftrvxmtrx/riow/9front.diff $h/lib/extra/ftrvxmtrx/patches/rio-select.patch $h/p/patch/$f)
-	ape/patch -s --no-backup-if-mismatch -p1 < $i
-cp -x $h/p/dot/vgadb /lib/vgadb
-rm -f (/lib/vgadb /rc/bin/ircrc /sys/man/4/nusb)^.orig
-
-cd /sys/src
-{
-	mk clean
-	for(i in $ko)
-		objtype=$i mk nuke
-	mk install || exit 'NOPE'
-	for(i in $ko)
-		if(! ~ $i $objtype)
-			objtype=$i mk install || exit 'NOPE'
-	mk clean
-	for(i in $ko)
-		objtype=$i mkp
-} | pump || exit 'NOPE'
-cd /sys/man
-mk
-
-for(i in $k){
-	cd /sys/src/9/^$i
-	mk clean && mk install && mk clean
-}
-9fs 9fat
-if(~ $objtype amd64 386){
-	rm /n/9fat/9bootfat
-	cp /386/9bootfat /n/9fat/
-	chmod +al /n/9fat/9bootfat
-}
-for(i in $k)
-	switch($i){
-	case pc
-		if(! ~ $sysname aib)
-			cp /386/9pc /n/9fat/
-	case pc64
-		if(! ~ $sysname aib)
-			cp /amd64/9pc64 /n/9fat/
-	case zynq
-		cp /arm/9zynq /n/9fat/
-	}
-unmount /n/9fat
-unmount /n/9
-rm /srv/dos
-} >>/tmp/mku.$pid
-#echo sync >>/srv/hjfs.cmd
-rm /tmp/mku.$pid
--- a/mlu
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/rc
-if(! ~ $#* 2){
-	echo usage: $0 listname destdir
-	exit usage
-}
-9fs lists.9front.org
-cd /n/lists.9front.org/lists/$1
-syncab /n/lists.9front.org/lists/$1 $2 | tee | rc
--- a/mpi
+++ /dev/null
@@ -1,5 +1,0 @@
-#!/bin/rc
-rfork n
-ep=ep9.4
-! ~ $#* 0 && ep=$1
-games/dmid -s /dev/usb/$ep/data | games/opl3 | norm 5 >/dev/audio
--- a/nes
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/256;
-		b=$2/240;
-		c=int(b<a?b:a);
-		if(c*256 == $1 || c*240 == $2)
-			c--;
-		print "-dx", c*256+8, "-dy", c*240+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba 1 | {games/nes -a $*(3-) || games/nes $*(3-)}
-if not
-	games/nes -a $* || games/nes $*
--- a/nesj
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/bin/rc
-
-n=`{sed -n '/ep.\.0/h;${g;s/^(ep.\.0).*/\1/p;}' /dev/usb/ctl}
-while(~ $1 -?){
-	switch($1){
-	case -k	# just make /sys/src/9/boot/nusbrc do nothing if it sees your
-		# device instead
-		p=`{ps | sed -n '/ kb$/h;${g;s/^[^ ]+ +([0-9]+) .*/\1/p;}'}
-		echo kill >/proc/$p/note
-		wait $p
-	case -n
-		n=ep$2.0
-		shift
-	}
-	shift
-}
-
-echo resize -dx 776 -dy 728 >/dev/wctl
-nusb/joy /dev/usb/$n | joynes 1 | games/nes -a3 $*
-# press Kdel again to kill nusb/joy...
--- a/oots
+++ /dev/null
@@ -1,24 +1,0 @@
-#!/bin/rc
-# finds out which is the last comic, then downloads missing ones from cwd, exiting
-# upon the first collision
-# it's filthy.
-
-flag e +
-
-#x=(/comics/oots0002.html)
-x=(`{hget http://www.giantitp.com \
-| sed -n 's/<B>Order of the Stick <\/B><A href="([^"]+)".*/\1/p'})
-n=`{echo $x | sed 's/.*(oots[0-9]+\.)html/\1/'}
-while(! ~ $n '#' && ! test -e $n^*){
-	x=(`{hget http://www.giantitp.com/$x(1) \
-	| sed -n '
-		/IMG src="\/comics/{
-			s/.*src="([^"]+)".*/\1/p
-			q
-		}
-		s/.*<A href="([^"]+)"><IMG src="\/Images\/redesign\/ComicNav_Back.gif".*/\1/p'
-	})
-	n=$n^`{echo $x(2) | sed 's/.*\.([^\/\.]+)$/\1/'}
-	hget http://www.giantitp.com/$x(2) >$n
-	n=`{echo $x(1) | sed 's/.*(oots[0-9]+\.)html/\1/'}
-}
--- a/pcm2opus
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-audio/opusenc --bitrate 128 --music --downmix-stereo 
--- a/pcmf
+++ /dev/null
@@ -1,10 +1,0 @@
-#!/bin/rc
-rfork n
-t=/tmp/pplay.$pid
-fn clean{ rm -f $t }
-fn sigexit{ clean }
-fn sigint{ clean }
-ramfs
-play -o /tmp/pplay.$pid $* >[2]/dev/null
-pplay -f /tmp/pplay.$pid
-rm -f /tmp/pplay.$pid
--- a/psam
+++ /dev/null
@@ -1,18 +1,0 @@
-#!/bin/rc
-r=()
-switch($vgasize){
-case 3840x2160x*
-	r=(0 564 3840 1882)
-case 1920x1200x*
-	r=(0 0 1920 1018)
-case 1920x1080x*
-	r=(0 0 1920 898)
-case 1600x1200x*
-	r=(0 0 1920 928)
-case 1400x1050x*
-	r=(0 0 1400 906)
-case 1366x768x*
-	r=(0 0 1366 625)
-}
-if(! ~ $#r 0)
-	window -m -r $r sam -a $* $home/p/not/todo.proj
--- a/qdemo
+++ /dev/null
@@ -1,13 +1,0 @@
-#!/bin/rc
-window -r 952 0 1920 608 'cd lib/dm/plt; doom -z plt -noztele -playdemo dime >/dev/null >[2=1]'
-window -r 156 -1 964 607 'quake2 +set game q2dq2 >/dev/null >[2=1]'
-window -r 2 474 810 1082 'qk1 -m 24 >/dev/null >[2=1]'
-window -r 806 597 1454 1005 'wl3d -s'
-window -r 1450 596 1921 1081 'p $home/p/rc/qdemo; read -c 1'
-window -r 0 0 160 478 'stats -lmsc'
-window -scroll -r 806 1026 1194 1080 'play mv/gojira.torii.mp3 m/gojira.*'
-
-# todo: do these automatically:
-# q2dq2: map run/base1.dm2
-# qk1: playdemo start
-# wl3d: either find good demos, or just play a game while the rest is going
--- a/qk1
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/rc
-rfork ne
-switch($sysname){
-case x220 w520 t61p2 t61p
-	res=(-dx 1032 -dy 776)
-case hsw
-	res=(-dx 1608 -dy 1208)
-	a=(-m 32)
-case *
-	res=(-dx 808 -dy 608)
-}
-echo resize $res >/dev/wctl
-bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
-quake $a $* >/dev/null
--- a/qk2
+++ /dev/null
@@ -1,28 +1,0 @@
-#!/bin/rc
-rfork ne
-res=(-dx 808 -dy 608)
-noresz=()
-c=(quake2)
-# launch ctf with: qk2 -g ctf $* +set ctf 1
-# launch crbot with: qk2 -g crbot $* +set deathmatch 1 +set ctf 0
-while(~ $1 -?){
-	switch($1){
-	case -g
-		# mods' executables are named q2$x
-		c=(q2$2 +set game $2)
-		shift
-	case -m
-		cdmnt=$2
-		shift
-	case -r
-		res=(-dx `{echo $2 + 8 | pc -n} -dy `{echo $3 + 8 | pc -n})
-		shift 2
-	case -z
-		noresz=1
-	}
-	shift
-}
-if(~ $#noresz 0)
-	echo resize $res >/dev/wctl
-bind -q /sys/games/lib/quake2/cd /mnt/cd	# cdfs(4)
-$c $* >/dev/null
--- a/qk3
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-echo scroll >/dev/wctl
-#cd /sys/games/lib/quake3 && q3ded +set developer 1 +set fs_game cpma +map cpm22
-cd /sys/games/lib/quake3 && q3ded +set developer 1 +map q3dm17
--- a/qw
+++ /dev/null
@@ -1,13 +1,0 @@
-#!/bin/rc
-rfork ne
-switch($sysname){
-case x220 w520 t61p2 t61p
-	res=(-dx 1032 -dy 776)
-case hsw
-	res=(-dx 1608 -dy 1208)
-case *
-	res=(-dx 808 -dy 608)
-}
-echo resize $res >/dev/wctl
-bind -q /sys/games/lib/quake/cd /mnt/cd	# cdfs(4)
-qwcl -mem 32 $* >/dev/null
--- a/repou
+++ /dev/null
@@ -1,18 +1,0 @@
-#!/bin/rc
-# giturl\tname\tdir\tdesc
-awk '
-BEGIN{
-	FS="\t"
-}$1 !~ /^(#|$)/{
-	print $2
-	basedir = $3
-	sub("/[^/]+$", "", basedir)
-	# yikes
-	if(system("test -d " $3) != 0){
-		system("mkdir -p " basedir)
-		system("git/clone " $1 " " $3)
-	}else{
-		system("rc -c \''cd " $3 "; git/pull\''")
-	}
-}
-' $home/p/lib/^(plan9 unix)
--- a/riostart
+++ /dev/null
@@ -1,10 +1,0 @@
-#!/bin/rc
-sizes
-. /tmp/sizes
-window -scroll -r $kprintrect cat /dev/kprint
-window -r $catrect games/catclock
-window -r $volrect volume
-window -r $statrect stats -lmsedz
-window -scroll -r $cmdrect 'label cmd; rc'
-window -r $duckrect duck
-window -r $riowrect 'label riow; riow </srv/riogkbd*'
--- a/rsam
+++ /dev/null
@@ -1,44 +1,0 @@
-#!/bin/rc
-rfork ne
-switch($vgasize){
-case 3840x2160x*
-	r=(0 564 3840 2152)
-	rs=(0 564 3840 1882)
-	rw=(0 1616 714 2160)
-case 1920x1200x*
-	r=(0 0 1920 1192)
-	rs=(0 0 1920 1018)
-	rw=(0 656 714 1200)
-case 1920x1080x*
-	r=(0 0 1920 1072)
-	rs=(0 0 1920 898)
-	rw=(0 536 714 1080)
-case 1600x1200x*
-	r=(0 0 1920 1192)
-	rs=(0 0 1920 928)
-	rw=(0 656 714 1200)
-case 1400x1050x*
-	r=(0 0 1400 1042)
-	rs=(0 0 1400 906)
-	rw=(0 506 714 1050)
-case 1366x768x*
-	r=(0 0 1366 760)
-	rs=(0 0 1366 625)
-	rw=(0 224 714 768)
-}
-if(~ $#r 0)
-	exit 'nope, unknown resolution'
-f=()
-if(test -f $home/lib/rsam){
-	f=`{cat $home/lib/rsam}
-	eval 'f=('^$"f^')'
-}
-cat <<! >/env/fuckrc
-unmount /mnt/plumb
-plumber
-rio -k '
-	window -r $rw -scroll
-	window -r $rs sam -a $* $f
-'
-!
-window -m -hide -r $r rc /env/fuckrc
--- a/shl
+++ /dev/null
@@ -1,11 +1,0 @@
-#!/bin/rc
-awk '
-BEGIN{
-	srand()
-}
-{
-	printf "%06d	%s\n", rand() * 1000000, $0
-}
-' |\
-	sort -n |\
-	sed 's/^[0-9]+	//'
--- a/sizes
+++ /dev/null
@@ -1,76 +1,0 @@
-#!/bin/rc
-screensize=`{echo $vgasize | sed 's/x/ /g'}
-#screensize=`{file /dev/screen | sed 's/.*size ([^x]+)x([^x]+)/\1 \2/'}
-# general placements
-briorect=(0 0 $screensize(1) `{echo $screensize(2) - 16 | pc -n})
-bsamrect=(0 0 $briorect(3) `{echo $briorect(4) - 64 | pc -n})
-bcmdrect=( \
-	0 \
-	`{echo $bsamrect(4) - $bsamrect(4) / 3 | pc -n} \
-	`{echo $bsamrect(3) / 3 | pc -n} \
-	$briorect(4) \
-)
-# default windows
-catrect=( \
-	0 \
-	0 \
-	130 \
-	296 \
-)
-volrect=( \
-	`{echo $catrect(3) + 4 | pc -n} \
-	0 \
-	768 \
-	28 \
-)
-kprintrect=( \
-	$volrect(1) \
-	`{echo $volrect(4) + 4 | pc -n} \
-	$volrect(3) \
-	`{echo $catrect(4) / 2 | pc -n} \
-)
-statrect=( \
-	$volrect(1) \
-	`{echo $kprintrect(4) + 4 | pc -n} \
-	$volrect(3) \
-	$catrect(4) \
-)
-cmdrect=( \
-	0 \
-	`{echo $catrect(4) + 4 | pc -n} \
-	$volrect(3) \
-	$screensize(2) \
-)
-riowrect=( \
-	`{echo $screensize(1) - 100 | pc -n} \
-	`{echo $screensize(2) - 28 | pc -n} \
-	$screensize(1) \
-	$screensize(2) \
-)
-zukerect=( \
-	`{echo $screensize(1) - 768 | pc -n} \
-	0 \
-	$screensize(1) \
-	$screensize(2) \
-)
-duckrect=( \
-	`{echo $screensize(1) / 2 | pc -n} \
-	0 \
-	$screensize(1) \
-	`{echo $screensize(2) - 256 | pc -n} \
-)
-
-cat <<! >/tmp/sizes
-screensize=($screensize)
-briorect=($briorect)
-bsamrect=($bsamrect)
-bcmdrect=($bcmdrect)
-catrect=($catrect)
-volrect=($volrect)
-kprintrect=($kprintrect)
-statrect=($statrect)
-cmdrect=($cmdrect)
-riowrect=($riowrect)
-zukerect=($zukerect)
-duckrect=($duckrect)
-!
--- a/skey
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-rfork n
-games/wadfs /sys/games/lib/doom/d2/doom2.wad >[2]/dev/null
-mkey | games/dmid -s | games/opl3 | norm 5 >/dev/audio
--- a/snes
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-echo resize `{echo $vgasize |\
-	awk -Fx '{
-		a=$1/256;
-		b=$2/239;
-		c=int(b<a?b:a);
-		if(c*256 == $1 || c*239 == $2)
-			c--;
-		print "-dx", c*256+8, "-dy", c*239+8
-	}'
-} >/dev/wctl
-if(~ $1 -j)
-	nusb/joy /dev/usb/ep^$2^.0 | joygba | {games/snes -a $*(3-) || games/snes $*(3-)}
-if not
-	games/snes -a $* || games/snes $*
--- a/stealrc
+++ /dev/null
@@ -1,12 +1,0 @@
-#!/bin/rc
-repo=$home/lib/extra
-dest=$home/bin/rc
-cp -x \
-	$repo/kvik/bin.rc/bin/^(last pfx) \
-	$repo/jpm/rc/^(fcalls fman h top ircx netproc irctime) \
-	$repo/ftrvxmtrx/rc/youtube \
-	$repo/aiju/rc/fun \
-	$repo/qrstuv/9paste \
-	$repo/sources.extra/ps2txt \
-	$repo/henesy/gelinks.rc \
-	$dest
--- a/syncab
+++ /dev/null
@@ -1,43 +1,0 @@
-#!/bin/rc
-rfork n
-nomtime=0
-if(~ $1 -m){
-	nomtime=1
-	shift
-}
-if(! ~ $#* 2){
-	echo usage: $0 [-m] left right
-	exit usage
-}
-
-ref=$1
-old=$2
-derp -t $ref $ref $old |\
-	awk \
-	-F'	' \
-	-v 'ref='^$ref \
-	-v 'old='^$old \
-	-v 'nomtime='^$nomtime \
-'
-BEGIN{
-	rm["na"] = rm["dn"] = rm["dm!"] = 1
-	if(nomtime)
-		nocp["nm"] = 1
-}
-{
-	gsub("\''", "\''\''", $2)
-	if($1 in rm)
-		ls["rm"] = "''" old "/" $2 "'' " ls["rm"]
-	else if(! ($1 in nocp))
-		ls["cp"] = ls["cp"] " " "''" $2 "''"
-	cnt[$1]++
-}
-END{
-	for(i in cnt)
-		print "#" i, cnt[i]
-	if("rm" in ls)
-		print "rm", ls["rm"]
-	if("cp" in ls)
-		print "@{cd", ref, "; tar c", ls["cp"], "} | @{cd", old, "; tar xT}"
-}
-'
--- a/syncbv91
+++ /dev/null
@@ -1,29 +1,0 @@
-#!/bin/rc -e
-rfork n
-if(! ~ $#* 1){
-	echo usage: $0 sys
-	exit usage
-}
-if(! sshfs tcp!$1!8022){
-	echo ssh failed: $status
-	exit ssh
-}
-cd
-# sd card mtimes are full of lies
-if(~ $1 ule){
-	for(i in m*){
-		if(! test -d /n/ssh/m)
-			ssh tcp!bv91!8022 ln -s storage/external-1/m m || exit
-		if(! test -d /n/ssh/m/$i)
-			clone -T $i /n/ssh/m/
-		if not
-			syncab -m $i /n/ssh/m/$i | tee -a /tmp/sync.$pid
-	}
-}
-syncab $home/lib/i /n/ssh/Pictures | tee -a /tmp/sync.$pid
-echo proceed?
-if(! ~ `{read} yes){
-	echo exiting
-	exit nope
-}
-. /tmp/sync.$pid && rm /tmp/sync.$pid
--- a/sysup
+++ /dev/null
@@ -1,5 +1,0 @@
-#!/bin/rc -e
-bind -ac /dist/plan9front /
-old=`{git/query HEAD}
-sysupdate
-git/query -c $old HEAD
--- a/t
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-if(~ $#* 1)
-	*=(ssh tcp!$1!x)
-vt -2bf /lib/font/bit/fixed/unicode.6x10.font $*
--- a/tac
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/awk -f
-{
-	l[NR] = $0
-}
-END{
-	while(NR > 0)
-		print l[NR--]
-}
--- a/tcp19000
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-cd /usr/share/radio
-while(~ $status '')
-	dd -bs 512x1024 -if `{fortune <{ls}} >[2]/dev/null
--- a/tcp19564
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-exec tlssrv -A -l 9dump -r `{cat $3/remote} /bin/exportfs -R -r /usr/share
--- a/theme
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-picker </dev/theme >/dev/theme
--- a/themeset
+++ /dev/null
@@ -1,5 +1,0 @@
-#!/bin/rc -e
-cat $home/lib/theme/rio >/mnt/wsys/theme
-sleep 0.5
-grep softscreen /dev/vgactl >>/dev/vgactl
-echo hwblank off >>/dev/vgactl
--- a/tospr
+++ /dev/null
@@ -1,51 +1,0 @@
-#!/bin/rc -e
-# FIXME: includes garbage past the end
-fn cleanup{
-	if(! ~ $#tf 0)
-		rm -f $tf
-	tf=()
-}
-fn sigint{
-	cleanup
-	exit
-}
-fn sigexit{
-	cleanup
-}
-
-if(! ~ $#* 2){
-	echo usage: $0 pal image
-	exit usage
-}
-tf=/tmp/tospr.$pid
-iconv -uc r8g8b8 $2 > $tf
-r=`{awk '{ print $4-$2, $5-$3; exit }' $tf}
-awk '
-NR == 1{
-	npal = $2
-}
-FNR == NR && NR != 1{
-	pal[$1] = NR-2
-}
-FNR == 1 && NR != 1{
-	print "sprite", '^$r(1)^,^$r(2)^',"'^$1^'"
-}
-FNR != NR{
-	if($1 in pal)
-		printf "%d ", pal[$1]
-	else{
-		print "value " $1 " not in palette!"
-		exit
-	}
-	if(++px == '^$r(1)^'){
-		printf "\n"
-		px = 0
-	}
-}
-' $1 <{dd -bs 5x12 -skip 1 <$tf >[2]/dev/null \
-	| xd -1x \
-	| ssam '
-,s/^....... +//g
-s/\n/ /g
-s/(..) (..) (..) /0x\3\2\1\n/g
-'}
--- a/tx
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-if(~ $#* 1)
-	*=(ssh tcp!$1!x)
-vt -xbf /lib/font/bit/fixed/unicode.6x10.font $*
--- a/ufo
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/rc -e
-rfork n
-srv tcp!plan-nue.youkai.pw!4458 ufo /n/ufo
-rm /srv/ufo
-audio/mixfs
-rio -k 'window ''echo ''''pump -k 51200 -b 131072 </n/ufo/radio | audio/mp3dec >/dev/audio''''; rc'''
--- a/unhex
+++ /dev/null
@@ -1,17 +1,0 @@
-#!/bin/awk -f
-# dd ... | xd -1x | ssam '...' | unhex | dd ...
-function hex(s, v){
-	if(s ~ /^0x/)
-		s = substr(s, 3)
-	for(n=1; n<=length(s); n++)
-		v = v * 16 + h[substr(s, n, 1)]
-	return v
-}
-BEGIN{
-	for(n=0; n<16; n++)
-		h[sprintf("%x", n)] = n
-}
-{
-	for(i=2; i<=NF; i++)
-		printf "%c", hex("0x" $i)
-}
--- a/unspr
+++ /dev/null
@@ -1,44 +1,0 @@
-#!/bin/rc
-if(! ~ $#* 2){
-	echo usage: $0 pal spr
-	exit usage
-}
-awk '
-function hex(s, v){
-	if(s ~ /^0x/)
-		s = substr(s, 3)
-	for(n=1; n<=length(s); n++)
-		v = v * 16 + h[substr(s, n, 1)]
-	return v
-}
-BEGIN{
-	for(n=0; n<16; n++){
-		h[sprintf("%x", n)] = n
-		h[sprintf("%X", n)] = n
-	}
-}
-FNR == 1{
-	x = $2
-	y = $3
-}
-FNR == NR{
-	sub(/0x/, "")
-	gsub(/../, "0x& ")
-	split($0, a)
-	c[i,3] = hex(a[1])
-	c[i,2] = hex(a[2])
-	c[i,1] = hex(a[3])
-	i++
-	next
-}
-{
-	if(FNR == 1){
-		printf "     r8g8b8           0           0%12d%12d ", x, y
-		next
-	}
-	for(i=1; i<=NF; i++){
-		n = $i + 1
-		printf "%c%c%c", c[n,1], c[n,2], c[n,3]
-	}
-}
-' $1 $2
--- a/v
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/rc
-rfork n
-if(~ $#* 0){
-	echo usage: $0 sys [vncvopts..]
-	exit usage
-}
-switch($1){
-case aib
-case t16
-case t30
-	sshnet tcp!$1!x || exit
-	*=u30
-case *
-	sshnet tcp!$1!x || exit
-}
-vncv -l utf8 -e corre $*
--- a/v+
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-awk '/^master/{print $1, $2+5}' /dev/volume >/dev/volume
--- a/v-
+++ /dev/null
@@ -1,2 +1,0 @@
-#!/bin/rc
-awk '/^master/{print $1, $2-5}' /dev/volume >/dev/volume
--- a/vmx9
+++ /dev/null
@@ -1,22 +1,0 @@
-#!/bin/rc
-rfork n
-switch($sysname){
-case w520
-	if(test -d /net/ether1)
-		n=ether1
-	if not
-		n=ether0
-	m=3G
-	echo scroll >/dev/wctl
-	vmx \
-		-M $m \
-		-n $n \
-		-d /tmp/iso/9front-6977.c7e7268b0786.iso \
-		-d /dev/sdE3/data \
-		-v 1024x768 \
-		$bootfile \
-		'user=glenda mouseport=ps2'
-	echo quit >'#X'/0/ctl
-case *
-	echo nope.
-}
--- a/vmxants
+++ /dev/null
@@ -1,22 +1,0 @@
-#!/bin/rc
-rfork n
-switch($sysname){
-case w520
-	if(test -d /net/ether1)
-		n=ether1
-	if not
-		n=ether0
-	m=3G
-	echo scroll >/dev/wctl
-	vmx \
-		-M $m \
-		-n $n \
-		-d /dev/sdE3/data \
-		-d /dev/sdUbff05/data \
-		-v 1024x768 \
-		$home/vmx/9ants64 \
-		'user=glenda mouseport=ps2 bootcmd=plan9rc tgzfs=no cdboot=yes'
-	echo quit >'#X'/0/ctl
-case *
-	echo nope.
-}
--- a/vmxbsd
+++ /dev/null
@@ -1,58 +1,0 @@
-#!/bin/rc
-rfork n
-if(test -d /net/ether1)
-	n=ether1
-if not
-	n=ether0
-switch($sysname){
-case u32
-	n=ether0
-	m=2G
-	d=/dev/sdU7af84/data
-	echo scroll >/dev/wctl
-	vmx \
-		-M $m \
-		-n $n \
-		-d $d \
-		-v vesa:1280x1024 \
-		/tmp/vmx/bsd65.rd \
-		'device=sd0a'
-case w520
-	if(~ $cputype amd64)
-		m=3G
-	if not
-		m=1G
-	if(test -f /tmp/vmx/bsd.img)
-		d=/tmp/vmx/bsd.img
-	if not
-		d=/dev/sdE1/data
-	if(test -f /dev/sdU999b0.0/data)
-		d=($d -d /dev/sdU999b0.0/data)
-	if(test -f /dev/sdU999b0.1/data)
-		d=($d -d /dev/sdU999b0.1/data)
-	echo scroll >/dev/wctl
-	vmx \
-		-M $m \
-		-n $n \
-		-d $d \
-		-v vesa:1200x800 \
-		/tmp/vmx/bsd65.sp \
-		'device=sd0a'
-case x220
-	if(~ $cputype amd64)
-		m=4G
-	if not
-		m=1G
-	echo scroll >/dev/wctl
-	vmx \
-		-M $m \
-		-n $n \
-		-d /dev/sdE0/data \
-		-v vesa:1366x768 \
-		$home/vmx/bsd64.sp \
-		'device=sd0a'
-case *
-	echo nope.
-	exit nope.
-}
-echo quit >'#X'/0/ctl
--- a/vmxlinux
+++ /dev/null
@@ -1,62 +1,0 @@
-#!/bin/rc
-rfork n
-
-vmid=`{awk '
-BEGIN{
-	i = 0
-	while(system("test -e \''#X\''/" i) == 0)
-		i++
-	print i
-}'}
-
-fn clean{
-	for(i in '#X'/$vmid/ctl)
-		echo quit > $i
-}
-fn sigexit{
-	clean
-}
-fn sigint{
-	clean
-}
-
-ver=5.12.14_1
-mac=2ec3bc946389
-n=ether0
-M=12G
-k=/tmp/vmx/vmlinuz-$ver
-m=/tmp/vmx/initramfs-^$ver^.img
-d=/dev/sdE0/data
-v=1280x1024
-c=('root=/dev/vda1')
-if(test -d '#l1'){
-	bind -aq '#l1' /net
-	n=ether1
-}
-while(~ $1 -?){
-	switch($1){
-	case -d; d=$2; shift;
-	case -e; d=($d -d $2); shift;
-	case -k; k=$2; shift;
-	case -l; psd listen || aux/listen;
-	case -M; M=$2; shift;
-	case -m; m=$2; shift;
-	case -n; n=$2; shift;
-	case -v; v=$2; shift;
-	case --; break;
-	case *
-		echo usage: $0 [opts] [--] [more opts]
-		exit usage
-	}
-	shift
-}
-echo $v | awk -Fx '{ print "resize -dx", $1+8, "-dy", $2+8 }' >/dev/wctl
-echo scroll >/dev/wctl
-vmx \
-	-d $d \
-	-M $M \
-	-m $m \
-	-n ea:$mac!$n \
-	-v vesa:$v \
-	$k \
-	$c $*
--- a/vncrio
+++ /dev/null
@@ -1,22 +1,0 @@
-#!/bin/rc
-rfork nefs
-font=/lib/font/bit/uga.font
-bind -c $home/tmp /tmp
-bind -a $home/bin/rc /bin
-bind -a $home/bin/$cputype /bin
-test -f $home/p/rc/bindbins && . $home/p/rc/bindbins
-test -f $home/lib/ass){
-	auth/factotum
-	setec
-}
-webcookies
-webfs
-plumber
-echo accelerated 5 >'#m'/mousectl
-prompt=('; ' '	')
-rio -k '
-	window -r 586 0 1280 584 9grid
-	window -r 0 0 732 602 mw
-	window -scroll -r 0 324 612 806 ii
-	window -scroll -r 607 749 1280 800 girc /tmp/ircs/''#cat-v''
-'
--- a/w
+++ /dev/null
@@ -1,7 +1,0 @@
-#!/bin/rc
-if(! ~ $#* 1){
-	echo $0 site
-	exit usage
-}
-hget http://wttr.in/~^$1^.png \
-	| page -w
--- a/wircrc
+++ /dev/null
@@ -1,315 +1,0 @@
-#!/bin/rc
-wins=()
-cons=()
-server=irc.freenode.net
-port=6667
-tls=0
-pass=()
-srvpass=()
-chans=()
-realname='<nil>'
-nick=$user
-
-while (~ $1 -*) {
-	switch ($1) {
-	case -c
-		chans=`{echo $2 | sed 's/,/ /'}
-		shift
-	case -n
-		nick=$2
-		shift
-	case -p
-		port=$2
-		shift
-	case -r
-		realname=$2
-		shift
-	case -T
-		tls=1
-	case -*
-		echo 'usage: wircrc [-c chans] [-n nick] [-p port] [-r realname] [-T] [server]' >[1=2]
-		exit 'usage'	
-	}
-	shift
-}
-if(~ $#* 1)
-	server=$1
-
-bind '#|' /n/wircrc
-rfork en
-
-fn wmk {
-	id=$1
-	>/n/wircrc/data1 {
-		@{
-			rfork s
-			d=/n/wircrc.$id
-			p=`{cat /dev/ppid}
-			mount $wsys $d 'new -scroll -pid '^$p || exit
-			echo -n $id | tr -d \x0a >$d/label
-			echo wnew $id $d $p
-			if(! ~ $#* 1)
-				echo cmsg $id $*(2-)
-			<$d/cons {
-				while(line=`{read}){
-					~ $line '' || echo wtype $id $line
-				}
-			}
-		}
-		echo wclose $id
-	}
-	exit
-}
-
-fn etime {
-	date -t | sed 's/-//g;s/^..(.*)T(..):(..).*/\1:\2\3/'
-}
-
-fn wio {
-	if(~ $1 $wins){
-		d=wd$1
-		d=$$d
-		@{echo `{etime} $*(2-) | tee -a /tmp/irc.^$1 >$d/cons}
-	}
-}
-
-fn sio {
-	d=$1
-	if(~ $d *!*)
-		d=`{echo $d | awk -F'!' '{print $1}'}
-	if(~ $d $cons){
-		d=cd$d
-		d=$$d
-		@{echo $*(2-) >$d/data}
-		@{echo $*(2-) | sed -n 's/^PRIVMSG [^ ]+ :/'^`{etime}^' '^$nick^' ⇒ /p' >>/tmp/irc^.$1}
-	}
-}
-
-fn wctl {
-	if(~ $1 $wins){
-		d=wd$1
-		d=$$d
-		shift
-		@{echo $* >$d/wctl}
-	}
-}
-
-fn hangup {
-	if(~ $1 $cons){
-		d=cpid$1
-		d=$$d
-		@{echo kill >/proc/$d/notepg}
-	}
-}
-
-fn getkey {
-	a=`{auth/userpasswd 'server='^$1^' service=irc user='^$nick >[2]/dev/null}
-	if(~ $#a 2)
-		pass=$a(2)
-	a=`{auth/userpasswd 'server='^$1^' service=ircsrv user='^$nick >[2]/dev/null}
-	if(~ $#a 2)
-		srvpass=$a(2)
-	a=()
-}
-
-fn dial {
-	c=/n/wircrc.$1
-	bind '#|' $c
-	if(~ $2 1){
-		tlsclient $1 <>$c/data1 >[1=0] &
-	}
-	if not{
-		aux/trampoline $1 <>$c/data1 >[1=0] &
-	}
-	<>/$c/data >[1=0]{
-		$*(3-) $c $apid
-		exit
-	}
-}
-
-fn irc {
-	>[3]/n/wircrc/data1 {
-		echo cnew $* >[1=3]
-		tr -d '\x2\x8\xd\x1f' | @{
-			while(line=`{read}){
-				if(~ $line(1) PING)
-					echo PONG $line(2-)
-				if not {
-					line=`{echo $line | sed '
-s/^:([^!]+)[^ ]+ PRIVMSG (#[^ ]+)[^:]+:(.*)/cmsg '$1'!\2 \1 \3/g;
-s/^:([^!]+)[^ ]+ PRIVMSG :?([^ ]+)[^:]+:(.*)/cmsg '$1'!\1 \1 \3/g;
-s/^:([^!]+)[^ ]+ NOTICE \*[^:]+:(.*)/cmsg '$1' \1 \2/g;
-s/^:([^!]+)[^ ]+ NOTICE ([^ ]+)[^:]+:(.*)/cmsg '$1'!\1 \1 \3/g;
-s/^:([^!]+)[^ ]+ (KICK) (#[^ ]+) ([^ ]+:?)(.*)/xmsg '$1'!\3 \2 \1 \4 \5/g;
-s/^:([^!]+)[^ ]+ ([0-9]+)[^:]+:?(.*)/xmsg '$1' \2 \3/g;
-s/^:([^!]+)[^ ]+ (MODE|TOPIC) (#[^ ]+) :?(.*)/xmsg '$1'!\3 \2 \4/g;
-s/^:([^!]+)[^ ]+ (QUIT|NICK) :(.*)/xmsg '$1' \2 \1 \3/g;
-s/^:([^!]+)[^ ]+ (JOIN|PART) (#[^\ ]+).*/xmsg '$1'!\3 \2 \1/g;
-s/^:(.*) (PONG) [^ ]+[^:]+:(.*)/cmsg '$1'!\1 \1 \2/g;
-'}
-					~ $line '' || echo $line >[1=3]
-				}
-			}
-		}
-		echo cclose $1 >[1=3]
-	}
-}
-
-fn shutdown {
-	for(i in $cons)
-		hangup $i
-	for(i in $wins){
-		d=wp$i
-		d=$$d
-		@{echo hangup >/proc/$d/notepg} &
-	}
-	{}>/n/wircrc/data
-}
-
-fn sighup {
-	shutdown
-}
-
-fn sigint {
-	shutdown
-}
-
-wmk $server &
-dial tcp!$server!$port $tls irc $server &
-
-</n/wircrc/data {
-	while(a=`{read}){
-		id=$a(2)
-		switch($a(1)){
-		case cnew
-			cd$id=$a(3)
-			cpid$id=$a(4)
-			cons=($id $cons)
-			getkey $id
-			if(! ~ $#srvpass 0)
-				sio $id PASS $srvpass
-			sio $id USER $user foo bar :$realname
-			sio $id NICK $nick
-			if(! ~ $#pass 0)
-				sio $id nickserv identify $pass
-			pass=()
-			srvpass=()
-			for(i in $chans){
-				if(~ $i $id!'#'*){
-					wmk $i &
-					sio $id JOIN `{echo $i | awk -F'!' '{print $2}'}
-				}
-			}
-		case cclose
-			d=cd$id
-			$d=()
-			oids=$cons
-			cons=()
-			for(i in $oids){
-				if(! ~ $i $id)
-					cons=($i $cons)
-			}
-			for(i in $wins){
-				if(~ $i $id || ~ $i $id!*)
-					wio $i HUNGUP $id
-			}
-		case wnew
-			wd$id=$a(3)
-			wp$id=$a(4)
-			wins=($id $wins)
-			#wio $id '---' $id '---'
-		case wclose
-			d=wd$id
-			p=wp$id
-			unmount $$d
-			$d=()
-			$p=()
-			oids=$wins
-			wins=()
-			for(i in $oids){
-				if(! ~ $i $id)
-					wins=($i $wins)
-			}
-			if(~ $id $chans){
-				oids=$chans
-				chans=()
-				for(i in $oids){
-					if(! ~ $i $id)
-						chans=($i $chans)
-				}
-				sio $id PART `{echo $id | awk -F'!' '{print $2}'}
-			}
-		case xmsg
-			if(~ $id $wins)
-				wio $id $a(3-)
-			if not {
-				for(i in $wins){
-					if(~ $i $id!*)
-						wio $i $a(3-)
-				}
-			}
-		case cmsg
-			if(~ $id $wins)
-				wio $id $a(3) '⇒' $a(4-)
-			if not if(~ $id $wins2)
-				echo $a >/n/wircrc/data1
-			if not if(! ~ $id *!'#'*){
-				wmk $id $a(3-) &
-				wins2=($id $wins2)
-			}
-		case wtype
-			switch($a(3)){
-			case /x
-				shutdown
-			case /s
-				server=$a(4)
-				if(! ~ $server '' && ! ~ $server $cons){
-					if(! ~ $server $wins)
-						wmk $server &
-					if(~ $a(5) port)
-						port=$a(6)
-					dial tcp!$server!$port $tls irc $server &
-				}
-			case /j /t
-				target=$a(4)
-				server=`{echo $id | awk -F'!' '{print $1}'}
-				if(! ~ $target '' && ~ $server $cons){
-					id=$server!$target
-					if(~ $id $wins){
-						wctl $id unhide
-						wctl $id current
-					}
-					if not {
-						wmk $id &
-					}
-					if(~ $a(3) /j && ~ $target '#'*){
-						if(! ~ $id $chans){
-							chans=($id $chans)
-							sio $server JOIN $target
-						}
-					}
-				}
-			case /h
-				if(~ $a(4) $cons)
-					id=$a(4)
-				hangup `{echo $id | awk -F'!' '{print $1}'}
-			case /n
-				nick = $a(4)
-				server=`{echo $id | awk -F'!' '{print $1}'}
-				sio $server NICK $a(4)
-			case /p
-				server=`{echo $id | awk -F'!' '{print $1}'}
-				sio $server PING $server
-			case *
-				target=`{echo $id | awk -F'!' '{print $2}'}
-				if(~ $target '')
-					sio $id $a(3-)
-				if not {
-					a=$a(3-)
-					sio $id PRIVMSG $target ':'^$"a
-				}
-			}
-		}
-	}
-}
-shutdown
--- a/wl
+++ /dev/null
@@ -1,25 +1,0 @@
-#!/bin/rc
-rfork n
-
-bind -b . /sys/games/lib/wl3d
-cd $home/lib/wl3d
-if(~ $1 -R){
-	r=(-dx $2 -dy $3)
-	shift 2
-}
-if not if(~ $#vgasize 0)
-	r=(-dx 328 -dy 208)
-if not
-	r=`{echo $vgasize |\
-		awk -Fx '{
-			a=$1/320;
-			b=$2/200;
-			c=int(b<a?b:a);
-			if(c*320 == $1 || c*200 == $2)
-				c--;
-			print "-dx", c*320+8, "-dy", c*200+8
-		}'
-	}
-
-echo resize $r >/dev/wctl
-wl3d $*
--- a/workspace
+++ /dev/null
@@ -1,12 +1,0 @@
-#!/bin/rc
-if(! test -d $home/lib/work){
-	echo no work files
-	exit 'no work nor worry'
-}
-. /tmp/sizes
-for(i in $home/lib/work/*){
-	window -hide -r $briorect $i
-	sleep 2
-	last=`{cd /dev/wsys; ls | sort -n | tail -1}
-	echo -n `{basename $i} >/dev/wsys/$last/label
-}
--- a/wpa
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/rc -e
-ip/ipconfig unbind || status=''
-if(! test -d /net/ether1)
-	bind -a '#l1' /net
-aux/wpa -s $1 /net/ether1
-ip/ipconfig ether /net/ether1
--- a/ya
+++ /dev/null
@@ -1,9 +1,0 @@
-#!/bin/rc
-# easiest way, low quality
-if(! ~ $#* 1){
-	echo usage $0 videoid
-	exit usage
-}
-nvi -A 251 -a /fd/1 $"1 |\
-	mcfs -t audio |\
-	audio/opusdec
--- a/yv
+++ /dev/null
@@ -1,9 +1,0 @@
-#!/bin/rc
-# easiest way, low quality
-if(! ~ $#* 1){
-	echo usage $0 videoid
-	exit usage
-}
-nvi -V 18 -v /tmp/vid.mp4 $"1 \
-	&& treason /tmp/vid.mp4 \
-	&& rm /tmp/vid.mp4
--- a/z
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-rfork n
-theme=$home/lib/theme/dicks
-audio/mkplist $* >[2]/dev/null | audio/zuke -cpD
--- a/z2
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/rc
-list=$1
-shift
-theme=$home/lib/theme/dicks audio/zuke -cpD $* <$list
--- a/übung
+++ /dev/null
@@ -1,53 +1,0 @@
-#!/bin/rc
-
-# FIXME: alternatives/synonyms: don't fail because of those
-# FIXME: examples, phrases
-# FIXME: verb conjugation
-# FIXME: meaning alternatives
-# FIXME: noun genders, plural, derivatives/compounds
-# FIXME: shuffle list every time it's parsed completely
-# FIXME: randomly ask english or german
-
-en=0
-files=$home/p/not/ger/^(adj adv cnj exp itj nou prn prp vrb)
-score=0
-total=0
-
-fn sigint{
-	echo; echo deine Endsumme: $score/$total Punkte, pfff.
-	e
-	exit ''
-}
-
-fn chk{
-	a=$2
-	b=$1
-	if(~ $en 1){
-		a=$1
-		b=$2
-	}
-	echo -n was ist $a?'		'
-	if(! ~ `{read -n 1} $b)
-		echo NEIN! es ist $b!
-	if not
-		score=`{echo $score | awk '{print $1+1}'}
-	total=`{echo $total | awk '{print $1+1}'}
-}
-
-while(~ $1 -*){
-	switch($1){
-	case -e
-		en=1
-	}
-	shift
-}
-
-ifs='
-' l=(`{cat $files \
-	| sed '/^	/d;/^$/d;s/		*/	/g' \
-	| awk -F '	' 'BEGIN{srand()}{printf "%06d  %s\n", rand()*1000000, $0;}' \
-	| sort -n \
-	| sed 's/^[0-9]*  //'})
-while()
-	for(i in $l)
-		chk `{echo $i | awk -F '	' '{printf "%s\n%s", $1, $2}'}