ref: 2d6bbef1ba45ceb41742387038400e1358cb7573
parent: addceb5b9f61e4d5bc961784fdcc75d2cbfbd93a
author: qwx <qwx@sciops.net>
date: Tue Mar 10 20:58:59 EDT 2020
remove subdirs, move everything to the root folder the subdirs pseudo-categorization was a bad idea. INDEX pending.
--- /dev/null
+++ b/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/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/cinrio
@@ -1,0 +1,6 @@
+#!/bin/rc -e
+truetypefs
+font=/n/ttf/unifont.ttf.16/font
+plumber
+rio
+unmount /mnt/plumb
--- /dev/null
+++ b/cpurio
@@ -1,0 +1,37 @@
+#!/bin/rc
+if(! ~ $sysname u16 && ~ `{ns | grep '#v'} ''){
+ screenrc
+ echo softscreen off >'#v/vgactl'
+ echo hwaccel on >'#v/vgactl'
+}
+rfork efns # weeeee
+font=/lib/font/bit/vga/unicode.font
+bind -a '#A' /dev
+bind -c $home/tmp /tmp
+bind -a $home/bin/rc /bin
+bind -a $home/bin/$cputype /bin
+if(test -d $home/p/rc)
+ bind -a $home/p/rc /bin
+if(test -f $home/p/dot/fn)
+ . $home/p/dot/fn
+if(! ~ $sysname u16 && test -f /tmp/sk){
+ auth/factotum
+ auth/aescbc -d </tmp/sk | read -m >/mnt/factotum/ctl
+}
+webcookies
+webfs
+plumber
+switch($sysname){
+case u28
+ echo pin 22 >'#A'/audioctl
+ echo inpin 23 >'#A'/audioctl
+case u11
+ echo pin 27 >'#A/audioctl'
+ echo inpin 25 >'#A'/audioctl
+}
+if(! ~ $sysname u16)
+ echo master 40 >'#A/volume'
+echo accelerated 3 >'#m'/mousectl
+prompt=('; ' ' ')
+rio -i riostart
+# might be nice to do dontkill '^(rio|rc)$'
--- a/crawl/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/crawl/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/crawl/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/crawl/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/'}
-}
--- /dev/null
+++ b/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/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
+'
--- a/drills/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/drills/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/drills/ü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}'}
--- /dev/null
+++ b/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/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/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 $*
--- a/gfx/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/gfx/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/gfx/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
--- /dev/null
+++ b/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/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/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 ..
+}
--- a/launch/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/launch/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/launch/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/launch/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/launch/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/launch/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/launch/qk1
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/rc
-rfork ne
-switch($sysname){
-case u24 u27 u20 u25
- res=(-dx 1032 -dy 776)
-case u11
- 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/launch/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/launch/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/launch/qw
+++ /dev/null
@@ -1,13 +1,0 @@
-#!/bin/rc
-rfork ne
-switch($sysname){
-case u24 u27 u20 u25
- res=(-dx 1032 -dy 776)
-case u11
- 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/launch/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/launch/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 $*
--- /dev/null
+++ b/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/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/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/pcm2opus
@@ -1,0 +1,2 @@
+#!/bin/rc
+audio/opusenc --bitrate 128 --music --downmix-stereo
--- /dev/null
+++ b/qk1
@@ -1,0 +1,14 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case u24 u27 u20 u25
+ res=(-dx 1032 -dy 776)
+case u11
+ 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/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/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/qw
@@ -1,0 +1,13 @@
+#!/bin/rc
+rfork ne
+switch($sysname){
+case u24 u27 u20 u25
+ res=(-dx 1032 -dy 776)
+case u11
+ 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/rc/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/rc/tac
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/awk -f
-{
- l[NR] = $0
-}
-END{
- while(NR > 0)
- print l[NR--]
-}
--- a/rc/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/rio/cinrio
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/rc -e
-truetypefs
-font=/n/ttf/unifont.ttf.16/font
-plumber
-rio
-unmount /mnt/plumb
--- a/rio/cpurio
+++ /dev/null
@@ -1,37 +1,0 @@
-#!/bin/rc
-if(! ~ $sysname u16 && ~ `{ns | grep '#v'} ''){
- screenrc
- echo softscreen off >'#v/vgactl'
- echo hwaccel on >'#v/vgactl'
-}
-rfork efns # weeeee
-font=/lib/font/bit/vga/unicode.font
-bind -a '#A' /dev
-bind -c $home/tmp /tmp
-bind -a $home/bin/rc /bin
-bind -a $home/bin/$cputype /bin
-if(test -d $home/p/rc)
- bind -a $home/p/rc /bin
-if(test -f $home/p/dot/fn)
- . $home/p/dot/fn
-if(! ~ $sysname u16 && test -f /tmp/sk){
- auth/factotum
- auth/aescbc -d </tmp/sk | read -m >/mnt/factotum/ctl
-}
-webcookies
-webfs
-plumber
-switch($sysname){
-case u28
- echo pin 22 >'#A'/audioctl
- echo inpin 23 >'#A'/audioctl
-case u11
- echo pin 27 >'#A/audioctl'
- echo inpin 25 >'#A'/audioctl
-}
-if(! ~ $sysname u16)
- echo master 40 >'#A/volume'
-echo accelerated 3 >'#m'/mousectl
-prompt=('; ' ' ')
-rio -i riostart
-# might be nice to do dontkill '^(rio|rc)$'
--- a/rio/riostart
+++ /dev/null
@@ -1,127 +1,0 @@
-#!/bin/rc
-switch($vgasize){
-case 3840x2160x*
- window -r 3721 1877 3840 2160 games/catclock
- window -r 3032 934 3840 1882 mothra
- window -r 3280 1878 3725 2072 stats -lmsed
- window -r 3280 2068 3725 2116 volume
- window -scroll -r 3280 2112 3725 2160 'label shp; rc'
- window -r 2624 1878 3284 2160
- window -r 1968 1878 2628 2160
- window -r 1312 1878 1972 2160
- window -r 656 1878 1316 2160
- window -r 0 1878 660 2160
- window -r 0 1116 1005 1882 'label grid; rc'
- window -scroll -r 3180 0 3840 80 'label kprint; cat /dev/kprint'
- #window -scroll -r 3180 76 3840 126 'label ii; ii'
- window -r 3180 122 3840 202 tailirc
- window -scroll -r 3180 267 3840 848 'label irclog; tail /tmp/irc*!''#cat-v'''
- window -scroll -r 3180 150 3840 568
- window -scroll -r 1968 0 2628 568
- window -scroll -r 2624 0 3284 568
- window -r 1312 0 1972 568
- window -r 656 0 1316 568
- window -scroll -r 2526 564 3186 938 'label aib; aib'
- window -scroll -r 2526 934 3036 1260 'label usbevent; cat /dev/usbevent'
- #window -r 0 0 660 568 mw
-case 1920x1200x*
- #window -hide -r 1060 0 1920 1108 page lib/doc/igfx/hsw/intel-gfx-prm-osrc-hsw-commandreference-registers_0.pdf
- #window -hide -r 206 0 1065 1108 'page lib/doc/igfx/hsw/*display.pdf'
- #window -hide -r 0 0 1903 1200 'page lib/med/^(hem drm ifc rhu)^/col'
- window -r 840 1014 1244 1200 stats -lmsed
- window -r 714 924 844 1200 games/catclock
- window -scroll -r 840 970 1244 1018 'label shp; rc'
- window -r 840 924 1244 974 volume
- window -scroll -r 1240 0 1920 80 cat /dev/kprint
- window -scroll -r 1241 76 1920 162 'label wircrc; rc'
- window -scroll -r 4 656 718 1200
- window -scroll -r 676 0 1262 162
- window -r 676 158 1262 464
- window -r 676 460 1262 928
- window -r 1240 924 1920 1200
- window -scroll -r 1258 828 1920 928
- window -r 0 656 680 1200
- window -r 0 0 680 660
-case 1920x1080x*
- #window -r 886 0 1600 1112 'page lib/doc/igfx/hsw/^(*display.pdf *registers_0.pdf)'
- window -scroll -r 4 596 718 1080
- window 1240,596,1920,1080
- window 1258,332,1920,600
- window -scroll -r 1240 0 1920 101 cat /dev/kprint
- window -r 1240 97 1920 336
- window 840,894,1244,1080 stats -lmse
- window 714,805,844,1080 games/catclock
- window -scroll -r 840 850 1244 898 'label shp; rc'
- window -r 840 805 1244 854 volume
- window 676,398,1262,809
- window -scroll -r 676 0 1262 100
- window 676,96,1262,402
- window 0,596,680,1080
- window 0,0,680,600
-case 1600x1200x*
- window -hide -r 8 224 888 1080 mothra
- window -hide -r 1240 632 1920 864 pc
- window -hide -r 1240 860 1920 1080 dict -d pgw
- #window -r 886 0 1600 1112 'page lib/doc/igfx/hsw/^(*display.pdf *registers_0.pdf)'
- window -r 840 1014 1244 1200 stats -lmsed
- window -r 714 924 844 1200 games/catclock
- window -scroll -r 840 970 1244 1018 'label shp; rc'
- window -r 840 924 1244 974 volume
- window -scroll -r 4 656 718 1200
- window -r 676 0 1262 464
- window -r 676 460 1262 928
- window -r 1240 716 1920 1200 'label lowr; rc'
- window -r 1258 332 1920 720 'label midr; rc'
- window -r 1240 0 1920 336 'label topr; rc'
- window -r 0 656 680 1200
- window -r 0 0 680 660
-case 1400x1050x*
- window -hide -r 625 12 1390 838 mothra
- window -r 0 0 682 531
- window -r 0 527 682 1050
- window -r 679 902 812 1050 stats -lmse
- window -r 678 858 813 906 volume
- window -r 679 0 1400 531
- window -r 678 528 1400 861
- window -r 808 857 1400 1050
-case 1366x768x*
- window -r 1256 620 1366 768 stats -lmsed
- window -r 1256 576 1366 624 volume
- window -scroll -r 1256 532 1366 580 'label shp; rc'
- #window -r 1256 254 1366 536 games/catclock
- window -r 660 380 1260 768
- window -r 0 380 664 768
- window -r 0 0 664 384
- window -scroll -r 991 0 1366 91 cat /dev/kprint
-case 1280x800x*
- window -r 0 0 160 304 stats -lmsed
- window -r 0 300 160 348 volume
- window -scroll -r 0 344 160 392
- window -hide -r 66 0 836 718 mothra
- window -r 0 388 620 800
- window -r 616 0 1280 254
- window -r 156 0 654 392
- window -r 616 250 1280 800
-case 1024x768x*
- window 422,0,1022,400
- window -r 0 0 161 117 stats -lmswe
- window 0,477,534,768
- window 0,114,534,482
- window 529,395,1024,768
- window 158,0,427,118
-case 800x600x*
- window -r 0 0 160 232 stats -lmswed
- window -r 156 0 756 400
- window -r 0 226 132 512 games/catclock
-case '' # only u16
- window -r 0 0 160 116 stats -lmsed
- window -r 158 0 268 116 games/catclock
- window -scroll -r 264 0 594 115 tail -f /dev/kmesg
- window -r 0 112 594 500
- window -r 0 496 594 1024
- window -r 590 495 1280 1024
- window -hide -scroll -r 590 1 1280 499
- window -scroll -r 590 1 1280 499 tail -f lib/irc
-case *
- window
-}
--- a/rio/vncrio
+++ /dev/null
@@ -1,19 +1,0 @@
-#!/bin/rc
-font=/lib/font/bit/vga/unicode.font
-bind -c $home/tmp /tmp
-bind -a $home/bin/rc /bin
-bind -a $home/bin/$cputype /bin
-if(test -d $home/p/rc)
- bind -a $home/p/rc /bin
-if(test -f $home/p/dot/fn)
- . $home/p/dot/fn
-if(test -f /tmp/sk){
- auth/factotum
- auth/aescbc -d </tmp/sk | read -m >/mnt/factotum/ctl
-}
-webcookies
-webfs
-plumber
-echo accelerated 5 >'#m'/mousectl
-prompt=('; ' ' ')
-rio
--- /dev/null
+++ b/riostart
@@ -1,0 +1,127 @@
+#!/bin/rc
+switch($vgasize){
+case 3840x2160x*
+ window -r 3721 1877 3840 2160 games/catclock
+ window -r 3032 934 3840 1882 mothra
+ window -r 3280 1878 3725 2072 stats -lmsed
+ window -r 3280 2068 3725 2116 volume
+ window -scroll -r 3280 2112 3725 2160 'label shp; rc'
+ window -r 2624 1878 3284 2160
+ window -r 1968 1878 2628 2160
+ window -r 1312 1878 1972 2160
+ window -r 656 1878 1316 2160
+ window -r 0 1878 660 2160
+ window -r 0 1116 1005 1882 'label grid; rc'
+ window -scroll -r 3180 0 3840 80 'label kprint; cat /dev/kprint'
+ #window -scroll -r 3180 76 3840 126 'label ii; ii'
+ window -r 3180 122 3840 202 tailirc
+ window -scroll -r 3180 267 3840 848 'label irclog; tail /tmp/irc*!''#cat-v'''
+ window -scroll -r 3180 150 3840 568
+ window -scroll -r 1968 0 2628 568
+ window -scroll -r 2624 0 3284 568
+ window -r 1312 0 1972 568
+ window -r 656 0 1316 568
+ window -scroll -r 2526 564 3186 938 'label aib; aib'
+ window -scroll -r 2526 934 3036 1260 'label usbevent; cat /dev/usbevent'
+ #window -r 0 0 660 568 mw
+case 1920x1200x*
+ #window -hide -r 1060 0 1920 1108 page lib/doc/igfx/hsw/intel-gfx-prm-osrc-hsw-commandreference-registers_0.pdf
+ #window -hide -r 206 0 1065 1108 'page lib/doc/igfx/hsw/*display.pdf'
+ #window -hide -r 0 0 1903 1200 'page lib/med/^(hem drm ifc rhu)^/col'
+ window -r 840 1014 1244 1200 stats -lmsed
+ window -r 714 924 844 1200 games/catclock
+ window -scroll -r 840 970 1244 1018 'label shp; rc'
+ window -r 840 924 1244 974 volume
+ window -scroll -r 1240 0 1920 80 cat /dev/kprint
+ window -scroll -r 1241 76 1920 162 'label wircrc; rc'
+ window -scroll -r 4 656 718 1200
+ window -scroll -r 676 0 1262 162
+ window -r 676 158 1262 464
+ window -r 676 460 1262 928
+ window -r 1240 924 1920 1200
+ window -scroll -r 1258 828 1920 928
+ window -r 0 656 680 1200
+ window -r 0 0 680 660
+case 1920x1080x*
+ #window -r 886 0 1600 1112 'page lib/doc/igfx/hsw/^(*display.pdf *registers_0.pdf)'
+ window -scroll -r 4 596 718 1080
+ window 1240,596,1920,1080
+ window 1258,332,1920,600
+ window -scroll -r 1240 0 1920 101 cat /dev/kprint
+ window -r 1240 97 1920 336
+ window 840,894,1244,1080 stats -lmse
+ window 714,805,844,1080 games/catclock
+ window -scroll -r 840 850 1244 898 'label shp; rc'
+ window -r 840 805 1244 854 volume
+ window 676,398,1262,809
+ window -scroll -r 676 0 1262 100
+ window 676,96,1262,402
+ window 0,596,680,1080
+ window 0,0,680,600
+case 1600x1200x*
+ window -hide -r 8 224 888 1080 mothra
+ window -hide -r 1240 632 1920 864 pc
+ window -hide -r 1240 860 1920 1080 dict -d pgw
+ #window -r 886 0 1600 1112 'page lib/doc/igfx/hsw/^(*display.pdf *registers_0.pdf)'
+ window -r 840 1014 1244 1200 stats -lmsed
+ window -r 714 924 844 1200 games/catclock
+ window -scroll -r 840 970 1244 1018 'label shp; rc'
+ window -r 840 924 1244 974 volume
+ window -scroll -r 4 656 718 1200
+ window -r 676 0 1262 464
+ window -r 676 460 1262 928
+ window -r 1240 716 1920 1200 'label lowr; rc'
+ window -r 1258 332 1920 720 'label midr; rc'
+ window -r 1240 0 1920 336 'label topr; rc'
+ window -r 0 656 680 1200
+ window -r 0 0 680 660
+case 1400x1050x*
+ window -hide -r 625 12 1390 838 mothra
+ window -r 0 0 682 531
+ window -r 0 527 682 1050
+ window -r 679 902 812 1050 stats -lmse
+ window -r 678 858 813 906 volume
+ window -r 679 0 1400 531
+ window -r 678 528 1400 861
+ window -r 808 857 1400 1050
+case 1366x768x*
+ window -r 1256 620 1366 768 stats -lmsed
+ window -r 1256 576 1366 624 volume
+ window -scroll -r 1256 532 1366 580 'label shp; rc'
+ #window -r 1256 254 1366 536 games/catclock
+ window -r 660 380 1260 768
+ window -r 0 380 664 768
+ window -r 0 0 664 384
+ window -scroll -r 991 0 1366 91 cat /dev/kprint
+case 1280x800x*
+ window -r 0 0 160 304 stats -lmsed
+ window -r 0 300 160 348 volume
+ window -scroll -r 0 344 160 392
+ window -hide -r 66 0 836 718 mothra
+ window -r 0 388 620 800
+ window -r 616 0 1280 254
+ window -r 156 0 654 392
+ window -r 616 250 1280 800
+case 1024x768x*
+ window 422,0,1022,400
+ window -r 0 0 161 117 stats -lmswe
+ window 0,477,534,768
+ window 0,114,534,482
+ window 529,395,1024,768
+ window 158,0,427,118
+case 800x600x*
+ window -r 0 0 160 232 stats -lmswed
+ window -r 156 0 756 400
+ window -r 0 226 132 512 games/catclock
+case '' # only u16
+ window -r 0 0 160 116 stats -lmsed
+ window -r 158 0 268 116 games/catclock
+ window -scroll -r 264 0 594 115 tail -f /dev/kmesg
+ window -r 0 112 594 500
+ window -r 0 496 594 1024
+ window -r 590 495 1280 1024
+ window -hide -scroll -r 590 1 1280 499
+ window -scroll -r 590 1 1280 499 tail -f lib/irc
+case *
+ window
+}
--- /dev/null
+++ b/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/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/tac
@@ -1,0 +1,8 @@
+#!/bin/awk -f
+{
+ l[NR] = $0
+}
+END{
+ while(NR > 0)
+ print l[NR--]
+}
--- /dev/null
+++ b/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/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/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/vncrio
@@ -1,0 +1,19 @@
+#!/bin/rc
+font=/lib/font/bit/vga/unicode.font
+bind -c $home/tmp /tmp
+bind -a $home/bin/rc /bin
+bind -a $home/bin/$cputype /bin
+if(test -d $home/p/rc)
+ bind -a $home/p/rc /bin
+if(test -f $home/p/dot/fn)
+ . $home/p/dot/fn
+if(test -f /tmp/sk){
+ auth/factotum
+ auth/aescbc -d </tmp/sk | read -m >/mnt/factotum/ctl
+}
+webcookies
+webfs
+plumber
+echo accelerated 5 >'#m'/mousectl
+prompt=('; ' ' ')
+rio
--- /dev/null
+++ b/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/ü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}'}