ref: 826c3f3d7ff0fa2ca742b504afda62584b3803e6
parent: 78933e9c82b77eb61838b80e6da1482e6d9898b1
author: mkf <mkf@cloud9p.org>
date: Fri Dec 22 03:46:21 EST 2023
pasted: import a simple pastebin, modeled after old pastebin in old server. with some more checks.
--- /dev/null
+++ b/pasted
@@ -1,0 +1,20 @@
+#!/bin/rc
+# wm/pasted path
+# a simple pastebin, use with aux/listen
+if(! ~ $#* 1) {
+ echo 'usage: wm/pasted user' >[1=2]
+ exit usage
+}
+
+# not to override files
+fn genrand {
+ dir = $1
+ rand = `{dd -quiet 1 -if /dev/random -bs 2 -count 1 | xd -1 | awk '{$1=""; print $0}' | tr -d ' '}
+ if(test -e $dir/$rand){
+ genrand
+ }
+}
+
+genrand $1
+echo $rand
+read -m -c `{echo '1024 * 1024 * 5'| bc} > $dir/$rand