]> code.delx.au - monosys/commitdiff
Rearranged, tidied, deleted things, moved things
authorJames Bunton <jamesbunton@delx.net.au>
Tue, 11 Nov 2014 04:42:03 +0000 (15:42 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Tue, 11 Nov 2014 04:42:03 +0000 (15:42 +1100)
Some things were moved to dotfiles, renamed or deleted

27 files changed:
bin [new symlink]
bin/find-in-file [deleted file]
bin/passwdgen [deleted file]
mediapc-utils/disable-screen-blank.desktop [moved from scripts/disable-screen-blank.desktop with 100% similarity]
mediapc-utils/ffclicker [moved from scripts/ffclicker.py with 100% similarity]
mediapc-utils/focus-desktop.desktop [moved from scripts/focus-desktop.desktop with 100% similarity]
mediapc-utils/gen-new-list [moved from scripts/gen-new-list with 100% similarity]
mediapc-utils/mediawrap [moved from scripts/mediawrap.sh with 100% similarity]
mediapc-utils/monitor-dir [moved from scripts/monitor-dir with 100% similarity]
mediapc-utils/mythsymlink [moved from scripts/mythsymlink with 100% similarity]
scripts/aptorphan [moved from bin/aptorphan with 100% similarity]
scripts/banshee-reset-sync [new file with mode: 0755]
scripts/checkspace [moved from scripts/checkspace.py with 100% similarity]
scripts/custom-ubuntu-desktop [deleted file]
scripts/dyndns [moved from scripts/dyndns.py with 100% similarity]
scripts/java-decompile-recursive [new file with mode: 0755]
scripts/magnet [new file with mode: 0755]
scripts/pacorphan [moved from bin/pacorphan with 100% similarity]
scripts/photocopy [moved from bin/photocopy with 100% similarity]
scripts/psi-password.py [deleted file]
scripts/pysendmail [moved from bin/sendmail.py with 100% similarity]
scripts/rename-by-date [moved from bin/rename-by-date with 100% similarity]
scripts/scanimage-easy [new file with mode: 0755]
scripts/ssh-screen-wrapper [moved from bin/ssh-screen-wrapper with 80% similarity]
scripts/tcp-proxy [moved from scripts/proxy.py with 100% similarity]
scripts/usb-reset [moved from scripts/usbreset.py with 100% similarity]
scripts/xbmc-rom-browser-applaunch.sh [deleted file]

diff --git a/bin b/bin
new file mode 120000 (symlink)
index 0000000..528dc4e
--- /dev/null
+++ b/bin
@@ -0,0 +1 @@
+scripts
\ No newline at end of file
diff --git a/bin/find-in-file b/bin/find-in-file
deleted file mode 100755 (executable)
index df771fe..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/python2
-
-import sys
-
-try:
-    needle = sys.argv[1]
-    haystack = sys.argv[2]
-except IndexError:
-    print >>sys.stderr, "Usage: %s needle haystack" % sys.argv[0]
-    sys.exit(1)
-
-
-f = open(needle)
-magic = f.read(1024)
-f.close()
-
-chunk_size = 32768
-f = open(haystack)
-count = 0
-buf = ""
-while True:
-    newbuf = f.read(chunk_size)
-    if not newbuf:
-        break
-    buf += newbuf
-    pos = buf.find(magic)
-    if pos >= 0:
-        print "found", count + pos
-    count += len(buf) - len(magic)
-    buf = buf[-len(magic):]
-f.close()
-
diff --git a/bin/passwdgen b/bin/passwdgen
deleted file mode 100755 (executable)
index f774381..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python3
-
-import random, sys
-
-alnum_chars = list(filter(lambda c: c.isalnum(), map(chr, range(128))))
-full_chars = alnum_chars * 2 + list("!@#%^&*(){}[]/=?+_-;:,.<>")
-
-def generate(chars, length):
-    return "".join([random.choice(chars) for i in range(length)])
-
-def print_usage():
-    print("Usage: %s [length] [alnum|full]" % sys.argv[0])
-    sys.exit(1)
-
-if __name__ == "__main__":
-    if len(sys.argv) <= 1:
-        n = 20
-    elif sys.argv[1].isdigit():
-        n = int(sys.argv[1])
-    else:
-        print_usage()
-
-    if len(sys.argv) <= 2:
-        chars = alnum_chars
-    elif sys.argv[2] == "alnum":
-        chars = alnum_chars
-    elif sys.argv[2] == "full":
-        chars = full_chars
-    else:
-        print_usage()
-
-    print(generate(chars, n))
-
similarity index 100%
rename from scripts/ffclicker.py
rename to mediapc-utils/ffclicker
similarity index 100%
rename from scripts/mediawrap.sh
rename to mediapc-utils/mediawrap
similarity index 100%
rename from bin/aptorphan
rename to scripts/aptorphan
diff --git a/scripts/banshee-reset-sync b/scripts/banshee-reset-sync
new file mode 100755 (executable)
index 0000000..8bbbdfc
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash -e
+
+cd ~/.config/banshee-1
+sqlite3 banshee.db "UPDATE CoreTracks SET LastSyncedStamp = 0"
+
similarity index 100%
rename from scripts/checkspace.py
rename to scripts/checkspace
diff --git a/scripts/custom-ubuntu-desktop b/scripts/custom-ubuntu-desktop
deleted file mode 100755 (executable)
index df6dbf2..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/bin/bash -e
-
-RELEASE='12.04'
-PACKAGE_NAME="ubuntu-desktop-custom"
-PACKAGE_VERSION="1.0.$(date +%Y-%m-%d.%H-%M)"
-
-DEPENDS='
-aptitude
-atop
-build-essential
-colordiff
-cryptsetup
-curl
-dconf-tools
-dvdbackup
-elinks
-equivs
-exiftags
-fdupes
-git
-gnome-session-fallback
-gpick
-gstreamer-tools
-gvfs-bin
-hyphen-en-us
-imagemagick
-keepassx
-kid3-qt
-language-pack-en
-language-pack-gnome-en
-libav-tools
-libreoffice
-lightdm-gtk-greeter
-lvm2
-mercurial
-mplayer
-mythes-en-au
-mythes-en-us
-netcat-openbsd
-netcat6
-python-lxml
-rdesktop
-renameutils
-screen
-screenruler
-sqlite3
-sshfs
-subversion
-unrar
-vim
-xdotool
-xsel
-xtightvncviewer
-xz-utils
-zip
-'
-
-EXCLUDE='
-activity-log-manager-control-center
-app-install-data-partner
-apport-gtk
-branding-ubuntu
-checkbox-qt
-deja-dup
-empathy
-example-content
-gnome-session
-gnome-session-canberra
-gwibber
-ibus
-ibus-gtk3
-ibus-pinyin
-ibus-pinyin-db-android
-ibus-table
-in-switch
-kerneloops-daemon
-landscape-client-ui-install
-launchpad-integration
-nautilus-sendto
-nautilus-share
-rhythmbox
-rhythmbox-plugin-magnatune
-rhythmbox-ubuntuone
-software-center
-software-properties-gtk
-telepathy-idle
-thunderbird
-thunderbird-gnome-support
-transmission-gtk
-ubuntu-sounds
-ubuntuone-client-gnome
-ubuntuone-installer
-unity
-unity-2d
-unity-greeter
-whoopsie
-xul-ext-ubufox
-'
-
-
-####################
-# Preflight checks #
-####################
-
-if [ "$(lsb_release -r | cut -d ':' -f 2 | tr -d '   ')" != "$RELEASE" ]; then
-    echo "Sorry, at the moment this script only supports Ubuntu $RELEASE"
-    exit 1
-fi
-
-if ! grep -q universe /etc/apt/sources.list /etc/apt/sources.list.d/*.list; then
-    echo "You must enable universe in your apt sources.list"
-    exit 1
-fi
-
-if ! grep -q multiverse /etc/apt/sources.list /etc/apt/sources.list.d/*.list; then
-    echo "You must enable multiverse in your apt sources.list"
-    exit 1
-fi
-
-if ! which equivs-build > /dev/null; then
-    sudo apt-get install equivs
-fi
-
-
-
-##########################
-# Build the control file #
-##########################
-
-CONTROLFILE="$(tempfile)"
-echo "-- Writing control file to $CONTROLFILE"
-
-cat > "$CONTROLFILE" <<EOT
-Package: $PACKAGE_NAME
-Section: metapackages
-Priority: optional
-Standards-Version: 3.9.2
-Conflicts: ubuntu-desktop
-Replaces: ubuntu-desktop
-
-Version: $PACKAGE_VERSION
-Description: Customised Ubuntu desktop system
- Similar to ubuntu-desktop, but with some additions and removals.
-EOT
-
-function get_line {
-    line="$(apt-cache show ubuntu-desktop | grep "$1:")"
-    for pkg in $EXCLUDE; do
-        line="$(echo "$line" | sed -e "s/$pkg, //" -e "s/, $pkg\$//")"
-    done
-    echo -n "$line"
-}
-
-(
-echo
-
-get_line 'Depends'
-echo ", $(echo $DEPENDS | sed 's/ /, /g')"
-
-get_line 'Recommends'
-echo
-) >> "$CONTROLFILE"
-
-
-##################
-# Build the .deb #
-##################
-
-echo "-- Building .deb in working directory"
-equivs-build "$CONTROLFILE"
-rm -f "$CONTROLFILE"
-
-
-#############
-# Go go go! #
-#############
-
-echo "-- Go go go!"
-sudo aptitude install $DEPENDS
-sudo dpkg -i "${PACKAGE_NAME}_${PACKAGE_VERSION}_all.deb"
-sudo aptitude purge $EXCLUDE
-
similarity index 100%
rename from scripts/dyndns.py
rename to scripts/dyndns
diff --git a/scripts/java-decompile-recursive b/scripts/java-decompile-recursive
new file mode 100755 (executable)
index 0000000..afc6220
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if [ -z "$1" -o -z "$2" ]; then
+    echo "Usage: $0 src dest"
+    exit 1
+fi
+
+src="$1"
+dest="$2"
+mkdir -p "$dest"
+dest="$(cd "$dest" && pwd)"
+
+cd "$src"
+find . -name '*.class' | while read line; do
+    class="$(echo "$line"| sed -e 's|^\./||' -e 's|\.class$||' -e 's|/|.|g')"
+    javap -private -c "$class" > "${dest}/${class}.txt"
+done
+
diff --git a/scripts/magnet b/scripts/magnet
new file mode 100755 (executable)
index 0000000..62b8903
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if ! [[ "$1" =~ xt=urn:btih:([^&/]+) ]]; then
+    echo "Invalid magnet link"
+    exit 1
+fi
+
+filename="$(echo "$1" | sed -e 's/.*dn=//' -e 's/&.*//').torrent"
+echo "d10:magnet-uri${#1}:${1}e" > "$filename"
+chmod 0644 "$filename"
+
+echo "created $filename"
similarity index 100%
rename from bin/pacorphan
rename to scripts/pacorphan
similarity index 100%
rename from bin/photocopy
rename to scripts/photocopy
diff --git a/scripts/psi-password.py b/scripts/psi-password.py
deleted file mode 100755 (executable)
index d662159..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/python2
-# Copyright 2007 James Bunton <jamesbunton@fastmail.fm>
-# Licensed for distribution under the GPL version 2, check COPYING for details
-# Decodes a password taken from a Psi config.xml file
-
-
-import sys
-
-def decodePassword(passwd, key):
-    if not key:
-        return passwd
-    
-    result = ""
-    n1 = n2 = 0
-    while n1 < len(passwd):
-        x = 0
-        if n1 + 4 > len(passwd):
-            break
-        x += int(passwd[n1+0], 16) * 4096
-        x += int(passwd[n1+1], 16) * 256
-        x += int(passwd[n1+2], 16) * 16
-        x += int(passwd[n1+3], 16) * 1
-        result += chr(x ^ ord(key[n2]))
-        n1 += 4
-        n2 += 1
-        if n2 >= len(key):
-            n2 = 0
-    
-    return result
-
-if __name__ == "__main__":
-    try:
-        passwd = sys.argv[1]
-        key = sys.argv[2]
-    except:
-        print >> sys.stderr, "Usage: %s passwd jid" % sys.argv[0]
-        sys.exit(1)
-    print decodePassword(passwd, key)
-
similarity index 100%
rename from bin/sendmail.py
rename to scripts/pysendmail
similarity index 100%
rename from bin/rename-by-date
rename to scripts/rename-by-date
diff --git a/scripts/scanimage-easy b/scripts/scanimage-easy
new file mode 100755 (executable)
index 0000000..cb16ff6
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+NUM="$(expr 1 + "$(cat current)")"
+echo "${NUM}" > current
+OUT="$(printf "scan_%04d.jpg" "${NUM}")"
+
+scanimage --progress --mode color --resolution 300dpi --gamma-value 0.999451 > out.pnm
+echo "Scanning done..."
+
+tojpeg.py out.pnm "${OUT}" &&
+rm -f out.pnm
+open "${OUT}"
+echo "Written ${OUT}"
+
similarity index 80%
rename from bin/ssh-screen-wrapper
rename to scripts/ssh-screen-wrapper
index 51fe264cd058c1ac3d52451d549f26d1ebfe5c57..ee5aa6dbc1b45e7da69b79f9bc47e69c401d15ac 100755 (executable)
@@ -5,11 +5,11 @@ local_hostname="${hostname}.localnet"
 public_hostname="p${hostname}"
 
 if grep -q "^Host ${hostname}$" ~/.ssh/config; then
-       true
+    true
 elif ping -c1 -t1 "$local_hostname" &> /dev/null; then
-       hostname="$local_hostname"
+    hostname="$local_hostname"
 else
-       hostname="$public_hostname"
+    hostname="$public_hostname"
 fi
 
 exec ssh "$hostname" "$@" -t "bash --login -c 'screen -dR'"
similarity index 100%
rename from scripts/proxy.py
rename to scripts/tcp-proxy
similarity index 100%
rename from scripts/usbreset.py
rename to scripts/usb-reset
diff --git a/scripts/xbmc-rom-browser-applaunch.sh b/scripts/xbmc-rom-browser-applaunch.sh
deleted file mode 100755 (executable)
index c138607..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-killall xbmc.bin
-sleep 1
-killall -9 xbmc.bin
-
-
-echo "$@"
-"$@"
-
-
-sleep 1
-exec $(grep Exec ~/Desktop/xbmc.desktop | cut -d= -f2)
-