ref: 3519f1d58ff78407227adb5a3a202d7a4e626a93
parent: 2c27c3c16d0d97e89f2d121f3fa78b9ffe8cd969
author: kitzman <[email protected]>
date: Wed Jan 10 13:19:00 EST 2024
added more scripts
--- a/README
+++ b/README
@@ -1,14 +1,20 @@
scripts:
-bin/rc/chatcat - (stolen) grid chat
-bin/rc/gemhist - (stolen) gemnine history
-bin/rc/gfetch - (stolen) gfetch
-bin/rc/gridup - (stolen) mount grid stuff
-bin/rc/inferno - run inferno with unionfs
-bin/rc/librarysrv - ramfs-backed cfs caching example
-bin/rc/themeswitch - switch the theme and font
-bin/rc/txcheck - fd statistics for aux/statusbar
-bin/rc/vtb - green vt
+bin/rc/chatcat - (stolen) grid chat
+bin/rc/gemhist - (stolen) gemnine history
+bin/rc/gfetch - (stolen) gfetch
+bin/rc/gridup - (stolen) mount grid stuff
+bin/rc/inferno - run inferno with unionfs
+bin/rc/librarysrv - ramfs-backed cfs caching example
+bin/rc/rios/themeswitch - switch the theme and font
+bin/rc/txcheck - fd statistics for aux/statusbar
+bin/rc/vtb - green vt
+bin/rc/urcpu - ssh with no vt
+bin/rc/urexport - export local fs to unix
+bin/rc/urimport - import unix fs with u9fs
+bin/rc/D2X - acme decimal-to-hex
+bin/rc/X2D - acme hex-to-decimal
+bin/rc/Mails - acme Mail wrapper
lib/lua/net.lua - p9 wrappers for /net and /mnt/web
lib/lua/r2pipe.lua - r2pipe for lua
@@ -37,7 +43,7 @@
lib/theme/plateau.theme
lib/theme/white.theme
-patches (for themes):
+patches (for themes, compatible with sigrid's patch):
patches/faces.patch
patches/stats.patch
--- /dev/null
+++ b/bin/rc/D2X
@@ -1,0 +1,8 @@
+#!/bin/rc
+
+decstr=`{cat '/mnt/acme/'^$winid^'/rdsel'}
+hexstr=`{echo 'obase=16; ' $decstr | bc}
+if(! ~ $hexstr *error*)
+ echo -n $hexstr >'/mnt/acme/'^$winid^'/wrsel'
+if not
+ exit 'malformed decimal string'
--- /dev/null
+++ b/bin/rc/Mails
@@ -1,0 +1,5 @@
+#!/bin/rc
+
+outbox=/tmp/outbox
+
+exec Mail -s -o $outbox $*
--- /dev/null
+++ b/bin/rc/X2D
@@ -1,0 +1,8 @@
+#!/bin/rc
+
+hexstr=`{cat '/mnt/acme/'^$winid^'/rdsel' | tr a-z A-Z}
+decstr=`{echo 'ibase=16; ' $hexstr | bc}
+if(! ~ $decstr *error*)
+ echo -n $decstr >'/mnt/acme/'^$winid^'/wrsel'
+if not
+ exit 'malformed hexadecimal string'
--- /dev/null
+++ b/bin/rc/rios/themeswitch
@@ -1,0 +1,68 @@
+#!/bin/rc
+
+themev=/tmp/themerc
+acmedrc=/tmp/acmed.ed
+echo >$themev
+
+if(! ~ $#1 0)
+ themespec=$1
+
+switch($themespec) {
+case green
+ font=/lib/font/bit/uni-vga/u_vga16.font
+ # font=/lib/font/bit/zevv-peep/zevv-peep-14.font
+ # font=/lib/font/bit/spleen/spleen.12.font
+ # font=/lib/font/bit/tamzen/tamzen14.font
+ themepath=$home/lib/theme/green.theme
+case blit
+ font=/lib/font/bit/fixed/unicode.9x18B.font
+ font=/lib/font/bit/fixed/unicode.9x15B.font
+ themepath=$home/lib/theme/blit.theme
+case orange
+ font=/lib/font/bit/zevv-peep/zevv-peep-14.font
+ font=/lib/font/bit/tamzen/tamzen16.font
+ font=/lib/font/bit/fixed/unicode.9x15B.font
+ themepath=$home/lib/theme/orange.theme
+case gruvbox
+ font=/lib/font/bit/uni-vga/u_vga16.font
+ themepath=$home/lib/theme/gruvbox.theme
+case gruvboxl
+ font=/lib/font/bit/uni-vga/u_vga16.font
+ themepath=$home/lib/theme/gruvboxl.theme
+case white
+ font=/lib/font/bit/lucm/unicode.9.font
+ font=/lib/font/bit/lucidasans/typeunicode.7.font
+ # font=/lib/font/bit/pelm/unicode.8.font
+ font=/lib/font/bit/uni-vga/u_vga16.font
+ themepath=$home/lib/theme/white.theme
+case greeng
+ font=/lib/font/bit/zevv-peep/zevv-peep-16.font
+ themepath=$home/lib/theme/greengold.theme
+case nord
+ font=/lib/font/bit/pelm/unicode.8.font
+ themepath=$home/lib/theme/nord.theme
+case purple
+ font=/lib/font/bit/spleen/spleen.16.font
+ themepath=$home/lib/theme/purple.theme
+}
+
+>$acmedrc echo '2
+c
+'^$font^'
+.
+3
+c
+'^$font^'
+.
+w
+q'
+
+echo 'themespec='^$themespec >$themev
+echo 'font='^`{cat /env/font} >>$themev
+echo 'themepath='^`{cat /env/themepath} >>$themev
+
+echo $themev
+
+rm /env/theme^(rc spec v path)
+rm /env/acmed^(rc)
+
--- /dev/null
+++ b/bin/rc/urcpu
@@ -1,0 +1,10 @@
+#!/bin/rc
+
+uhost=$1
+
+if(~ $#uhost 0) {
+ echo 'usage: urcpu host'
+ exit 'usage'
+}
+
+exec ssh $uhost .local/bin/9 rc -il
--- /dev/null
+++ b/bin/rc/urexport
@@ -1,0 +1,57 @@
+#!/bin/rc
+
+uhost=$1
+srvname=$2
+srvrem=$3
+
+if(~ $#uhost 0) {
+ echo 'usage: urexport host [srv [srvrem]]'
+ exit 'usage'
+}
+
+if(! ~ $#srvname 0 && ! test -f /srv/$srvname)
+ exit $srvname does not exist
+if not
+ if(~ $#srvrem 0)
+ srvrem=srvname
+
+if(~ $#srvname 0) {
+ ipipe='/n/unixhub/fs!'^$uhost^'0'
+ opipe='/n/unixhub/fs!'^$uhost^'1'
+}
+if not {
+ ipipe='/n/unixhub/'^$srvname^'!'^$uhost^'!0'
+ opipe='/n/unixhub/'^$srvname^'!'^$uhost^'!1'
+}
+
+if(! test -f /srv/unixhub) {
+ hubfs -t -s unixhub -m /n/unixhub
+ touch /n/unixhub/ctl
+}
+if not
+ mount -c /srv/unixhub /n/unixhub
+
+if(test -f $ipipe)
+ rm $ipipe
+touch $ipipe
+
+if(test -f $opipe)
+ rm $opipe
+touch $opipe
+
+if(~ $#srvname 0) {
+ exportfs -r / <$ipipe >$opipe &
+}
+if not {
+ mount /srv/$srvname /n/$srvrem
+ exportfs -r /n/$srvrem <$ipipe >$opipe &
+}
+
+if(~ $#srvname 0) {
+ ssh $uhost .local/bin/socat \
+ unix-listen:srv/term.$apid - >$ipipe <$opipe &
+}
+if not {
+ ssh $uhost .local/bin/socat \
+ unix-listen:srv/$srvrem - >$ipipe <$opipe &
+}
--- /dev/null
+++ b/bin/rc/urimport
@@ -1,0 +1,21 @@
+#!/bin/rc
+
+rhost=$1
+ruser=()
+
+if(~ $#rhost 0) {
+ echo 'usage: urimport host'
+ exit 'usage'
+}
+
+ruser=`{echo $rhost | sed 's/^([a-zA-Z0-9]+)@.*/\1/g'}
+if(~ $#ruser 0)
+ ruser=`{cat /dev/user}
+
+if(! test -f /srv/execnet) {
+ execnet /n/execnet
+ srvfs execnet /n/execnet
+}
+mount -b /srv/execnet /net
+
+srv 'exec!ssh '^$rhost^' .local/bin/u9fs -l /dev/null -u '^$ruser^' -a none' $rhost