]> code.delx.au - monosys/commitdiff
Initial checkin
authorJames Bunton <jamesbunton@fastmail.fm>
Sat, 23 Jun 2007 12:17:45 +0000 (22:17 +1000)
committerJames Bunton <jamesbunton@fastmail.fm>
Sat, 23 Jun 2007 12:17:45 +0000 (22:17 +1000)
quines/quine.py [new file with mode: 0644]
quines/smallquine.py [new file with mode: 0644]
scripts/mount.fuse [new file with mode: 0755]
scripts/passwdgen [new file with mode: 0755]
scripts/wepkeygen [new file with mode: 0755]

diff --git a/quines/quine.py b/quines/quine.py
new file mode 100644 (file)
index 0000000..8f1b5b4
--- /dev/null
@@ -0,0 +1,2 @@
+var = 'var = %s\nprint var %% repr(var)'
+print var % repr(var)
diff --git a/quines/smallquine.py b/quines/smallquine.py
new file mode 100644 (file)
index 0000000..9a8aedf
--- /dev/null
@@ -0,0 +1 @@
+a='a=%r;print a%%a';print a%a
diff --git a/scripts/mount.fuse b/scripts/mount.fuse
new file mode 100755 (executable)
index 0000000..75d21bf
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# FUSE mount helper
+# Petr Klima <qaxi@seznam.cz>
+# James Bunton <jamesbunton@fastmail.fm>
+# Thanks to Miklos Szeredi <miklos@szeredi.hu>
+# to kick me to the right way
+#
+
+VERSION="0.0.2"
+PRGNAME=`basename $0`
+HOME=/root
+
+USAGE="${PRGNAME} version ${VERSION}
+usage: ${PRGNAME} fusefs_type#[mountpath] mountpoint [FUSE options]
+
+       example: ${PRGNAME} sshfs#root@tux:/ /mnt/tuxssh -o rw
+"
+
+function die {
+       echo -e "$PRGNAME# $1" >&2
+       [ -z "$2" ] && exit 128
+       exit "$2"
+}
+
+[ "$#" -ge 2 ] || die "${USAGE}"
+
+FSTYPE=${1%%\#*} # for now i have to be same as FUSE mount binary
+                # should be configurable
+
+export PATH
+FSBIN=`which ${FSTYPE} 2>/dev/null` \
+       || die "Can not find FUSE mount binary for FS ${FSTYPE}" 1
+
+MOUNTPATH=${1#*#}
+
+# was there an # in $1
+[ "$1" = "$MOUNTPATH" ] && MOUNTPATH=""
+
+MOUNTPOINT="$2"
+[ -d "${MOUNTPOINT}" ] || die "Directory ${MOUNTPOINT} does not exist"
+
+shift
+shift
+shift
+
+ignore_opts="(user|nouser|users|auto|noauto|_netdev)"
+
+OPTIONS=`echo $@ | sed -r "s/(,${ignore_opts}|${ignore_opts},)//g"`
+NEWOPTIONS=""
+OLDIFS="${IFS}"
+IFS=','
+for opt in ${OPTIONS}; do
+       NEWOPTIONS="${NEWOPTIONS} -o ${opt}"
+done
+IFS="${OLDIFS}"
+
+${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${NEWOPTIONS}
diff --git a/scripts/passwdgen b/scripts/passwdgen
new file mode 100755 (executable)
index 0000000..04302e8
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import random, string, sys
+
+def generate(length):
+       passwd = ""
+       for i in xrange(length):
+               c = random.choice(string.printable)
+               while c.isspace():
+                       c = random.choice(string.printable)
+               passwd += c
+       return passwd
+
+if __name__ == "__main__":
+       try:
+               n = int(sys.argv[1])
+       except:
+               print "Usage: %s length" % sys.argv[0]
+               sys.exit(1)
+
+       print generate(n)
+
+
+
+
diff --git a/scripts/wepkeygen b/scripts/wepkeygen
new file mode 100755 (executable)
index 0000000..7b07f7c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# Licensed under the GPL version 2
+# Copyright 2004 James Bunton <james@delx.cjb.net>
+
+import random
+import time
+import sys
+
+print "WEP Key Generator by James Bunton <james@delx.cjb.net>"
+
+table = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
+
+out = ""
+for i in xrange(26):
+       out += table[random.randint(0,15)]
+       
+print
+print "You're WEP key is:", out
+