summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xa.sh112
-rwxr-xr-xconvert2mp4116
-rwxr-xr-xdirsu10
-rwxr-xr-xdownload.sh3
-rwxr-xr-xdrop.sh22
-rwxr-xr-xgen-thumbs.sh4
-rwxr-xr-xgshot5
-rwxr-xr-xipv6.sh49
-rwxr-xr-xscan18
-rwxr-xr-xwatchdog.sh198
10 files changed, 0 insertions, 537 deletions
diff --git a/a.sh b/a.sh
deleted file mode 100755
index 4818c76..0000000
--- a/a.sh
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/bash
-######################################################
-#+ Simple archive script with multiple backends
-#+ Rev. 3 - 2/07/09 - optimum.reflex@gmail.com
-######################################################
-hlp () { # Help function
- echo "usage: $0 [--help] [archive] [sources]"
- echo "[sources] is the files or folder you want added to the archive."
- echo
- echo "[archive] is the name of the archive generated, including extension."
- echo "Extensions are: .7z .zip .bz2 .gz .lzma .tar.*"
- exit 0
-}
-
-if [ $# -lt 2 ]; then # Need atleast an archive and one source
- hlp
-fi
-
-tarfunc () { # function that does the work
- MSG="packing [$SRCD] to [$DIR/$TAR]... "
- case "$TAR" in
- *.7z )
- echo -n $MSG
- /usr/bin/7z a -mx=9 $DIR/$TAR $SRC
- ;;
- *.tar )
- echo -n $MSG
- /bin/tar -acf $DIR/$TAR $SRC
- ;;
- *.t* )
- echo -n $MSG
- /bin/tar -acZf $DIR/$TAR $SRC
- ;;
- *.bz2 )
- echo -n $MSG
- /bin/bzip2 -cq9 $SRC > $DIR/$TAR
- ;;
- *.gz )
- echo -n $MSG
- /bin/gzip -cq9 $SRC > $DIR/$TAR
- ;;
- *.zip )
- echo -n $MSG
- /usr/bin/zip -qr9 $DIR/$TAR $SRC
- ;;
- *.lzma )
- echo -n $MSG
- /usr/bin/lzma -cq9 $SRC > $DIR/$TAR
- ;;
- *)
- hlp;;
- esac
-}
-
-tdir () { # Determin target directory for archive
- if [ -d $1 ]; then
- if [ "$1" == "." ]; then
- DIR="$PWD"
- else
- DIR="$1"
- fi
- else
- DIR="$PWD"
- fi
-}
-
-case "$@" in
- *--help*) hlp;;
-esac
-
-TAR="`basename $1`"
-tdir `dirname $1` && shift
-
-if [ $# -gt 1 ]; then # If more than one source
- SRCD="$@" # all sources to $SRCD
- i=0 # counter
- while [ "$1" ]; do
- if [ $i -eq 0 ]; then # only if the first source
- SRC="$1" && shift
- if [ ! -r "$SRC" ]; then
- echo "Location [$SRC] does not exist or is unreadable."
- exit 1
- fi
- ((i++)) # increment
- else # if sources after the first
- if [ ! -r "$1" ]; then
- echo "Location [$1] does not exist or is unreadable."
- exit 1
- fi
- SRC="$SRC $1" && shift # copy current $SRC and append next source
- fi
- done
- tarfunc # do the work
-else # else if there is only one source
- SRC="$1"
- SRCD="$SRC" # copy $SRC
- if [ ! -r "$SRC" ]; then
- echo "Location [$SRC] does not exist or is unreadable."; exit 1
- elif [ -d "$SRC" ]; then # if source is a directory
- cd `dirname $SRC` # goto the directory one up from $SRC
- SRC="`basename $SRC`/" # change $SRC for correct directory packing structure
- fi
- tarfunc # do the work
-fi
-
-if [ $? -ne 0 ]; then # if last command failed
- cd $DIR
- rm -f $TAR && echo "failure detected, archive deleted."
- exit 1
-else
- echo "success!"; exit 0
-fi
diff --git a/convert2mp4 b/convert2mp4
deleted file mode 100755
index 1e8e975..0000000
--- a/convert2mp4
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python2
-#----------------------------------------------------
-# Author: Florian "Bluewind" Pritz <flo@xssn.at>
-#
-# Licensed under WTFPL v2
-# (see COPYING for full license text)
-#
-#----------------------------------------------------
-# Converts a file to an MP4 which can be played in a flash movie
-# Video: H264
-# Audio: MPEG-4 AAC
-#----------------------------------------------------
-
-'''"usage: %prog [options] <files>'''
-__version__ ='0.2'
-__desc__ = 'Use ++ before any argument to pass it directly to ffmpeg.(i.e. ++-r ++25)'
-
-import sys
-import os
-import subprocess
-from optparse import OptionParser
-
-def main():
- usage = "usage: %prog [options] <files>"
- p = OptionParser(version=__version__, usage=__doc__, description=__desc__)
- p.add_option("-s", "--size", dest="size", default=False,
- help="use <dimension> instead of input dimensions (e.g. 123x123)", metavar="<dimension>")
- p.add_option("--vb", dest="vbitrate", default="400000",
- help="change the video bitrate", metavar="<bitrate>")
- p.add_option("--ab", dest="abitrate", default="160000",
- help="change the audio bitrate", metavar="<bitrate>")
- p.add_option("-m", "--map", action="append", dest="maps", default=None,
- help="change the mappings", metavar="<input_stream_id:sync_stream_id>")
- p.add_option("--nd", action="store_false", dest="deinterlace", default=True,
- help="don't deinterlace the video")
-
- (options, args) = p.parse_args()
-
-
- if len(args) == 0:
- p.print_help()
- sys.exit()
-
- ffmpeg_args = []
-
- if options.size:
- ffmpeg_args.append("-s")
- ffmpeg_args.append(options.size)
- if options.vbitrate:
- ffmpeg_args.append("-b")
- ffmpeg_args.append(options.vbitrate)
- if options.abitrate:
- ffmpeg_args.append("-ab")
- ffmpeg_args.append(options.abitrate)
- if options.deinterlace:
- ffmpeg_args.append("-deinterlace")
- if options.maps:
- for cur_map in options.maps:
- ffmpeg_args.append("-map")
- ffmpeg_args.append(cur_map)
-
- for name in args:
- if name.startswith('++'):
- ffmpeg_args.append(name[2:])
-
- for name in args:
- if name.startswith('++'):
- continue
- p1 = subprocess.Popen(["echo", "-n", name], stdout=subprocess.PIPE)
- p2 = subprocess.Popen(["sed", "s/\(.*\)\..*/\\1/"], stdin=p1.stdout, stdout=subprocess.PIPE)
- name_mp4 = "tmp_" + p2.communicate()[0] + ".mp4"
- for encpass in ["1", "2"]:
- if encpass == "1":
- filename = "/dev/null"
- ffmpeg_args.append('-vpre')
- ffmpeg_args.append('medium_firstpass')
- else:
- filename = name_mp4
- ffmpeg_args.append('-vpre')
- ffmpeg_args.append('medium')
- subprocess.Popen(merge(
- [["ffmpeg", "-i", name,
- "-vcodec", "libx264",
-# "-r", "25",
-# "-g", "250", "-keyint_min", "25",
-# "-vpre", "hq",
-# "-coder", "ac", "-me_range", "16",
-# "-subq", "5", "-sc_threshold", "40",
- "-acodec", "libfaac",
-# "-ar", "44100",
-# "-cmp", "+chroma", "-partitions", "+parti4x4+partp8x8+partb8x8",
-# "-i_qfactor", "0.71", "-b_strategy", "1",
- "-threads", "0",
- "-pass", encpass,
- "-f", "mp4",
-# "-crf", "30",
- "-y"],
- ffmpeg_args, [filename]]
- )).communicate()[0]
-
- subprocess.Popen(["qt-faststart", name_mp4, "done_"+name_mp4]).communicate()[0]
-
-def merge(seq):
- merged = []
- for s in seq:
- for x in s:
- merged.append(x)
- return merged
-
-def file_exists(filename, options):
- if os.path.exists(filename) and not options.force:
- sys.stderr.write('Target "'+filename+'" already exists. Use --force to overwrite.\n')
- sys.exit(1)
-
-if __name__ == '__main__':
- main()
diff --git a/dirsu b/dirsu
deleted file mode 100755
index 2dc7d0b..0000000
--- a/dirsu
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-set -e
-if [[ -z $1 ]]; then
- target="$PWD"
-else
- target="$1"
-fi
-user="$(stat -c %U "$target")"
-cd "$target"
-exec su "$user" -c "cd $PWD; exec bash"
diff --git a/download.sh b/download.sh
deleted file mode 100755
index b1fe9f3..0000000
--- a/download.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-cd ${HOME}/drop
-urxvtc -geometry 70x1 -e aria2c $@
diff --git a/drop.sh b/drop.sh
deleted file mode 100755
index 8519e19..0000000
--- a/drop.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-#----------------------------------------------------
-# Author: Florian "Bluewind" Pritz <flo@xssn.at>
-#
-# Licensed under WTFPL v2
-# (see COPYING for full license text)
-#
-#----------------------------------------------------
-# called by incrond to manage ~/drop
-#----------------------------------------------------
-for file; do
- case $(file -b --mime-type "$file") in
- application/x-bittorrent)
- chmod 644 "$file"
- mv "$file" /mnt/mistral/flo/torrent/watch
- transmission-remote mistral:9091 -a "/mnt/mistral/flo/torrent/watch/$(basename "$file")"
- ;;
- *)
- # nothing
- ;;
- esac
-done
diff --git a/gen-thumbs.sh b/gen-thumbs.sh
deleted file mode 100755
index b259e1e..0000000
--- a/gen-thumbs.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-for i in "$@"; do
- convert "$i" -thumbnail 245 -gravity North -extent 245x153 -bordercolor white -border 6 -bordercolor grey60 -border 1 -background none -background black \( +clone -shadow 60x4+4+4 \) +swap -background none -flatten -depth 8 "t_$i"
-done
diff --git a/gshot b/gshot
deleted file mode 100755
index 2908454..0000000
--- a/gshot
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-file=$(scrot -s -e 'echo $f')
-gimp "$file"
-fb "$file"
-rm "$file"
diff --git a/ipv6.sh b/ipv6.sh
deleted file mode 100755
index e9625c9..0000000
--- a/ipv6.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/dash
-
-VERBOSE=1
-LOCAL_V6_ADDR='::1/64'
-
-TUNNEL_IF='sit0'
-RELAY='192.88.99.1'
-
-case "$1" in
- start)
- if [ -z "$LOCAL4" ]; then
- if [ -z "$LOCAL_IF" ]; then
- LOCAL_IF=$(ip -o route show \
- |sed -nre '/^default /s/^default .*dev ([^ ]+).*/\1/p')
- fi
- LOCAL4=$(ip -o addr show $LOCAL_IF | grep ' inet ' \
- | grep -v ' secondary ' | head -n 1 \
- | sed -e 's/.*inet \([^ ]*\) .*/\1/' -e 's/\/.*//')
- if [ -z "$LOCAL4" ]; then
- echo "Cannot find the IP address assigned to $LOCAL_IF"
- exit 1
- fi
- fi
-
- SUBNET=$(printf "%x%02x:%x%02x" $(echo $LOCAL4 | sed -e 's/\./ /g'))
- LOCAL6NET="2002:${SUBNET}"
- LOCAL6="${LOCAL6NET}${LOCAL_V6_ADDR}"
-
- if [ "$VERBOSE" ]; then
- echo "Local v4 address: $LOCAL4"
- echo "Local v6 address: $LOCAL6"
- echo "6to4 relay address: $RELAY"
- fi
-
- ip link set $TUNNEL_IF up
- ip addr add $LOCAL6 dev $TUNNEL_IF
- ip route add 2000::/3 via ::$RELAY
- ip route add $LOCAL6NET dev lo 2> /dev/null || true
- ;;
- stop)
- ip link set $TUNNEL_IF down
- ;;
- *)
- echo "Usage: $0 {start|stop}"
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/scan b/scan
deleted file mode 100755
index 8ae7304..0000000
--- a/scan
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-if [[ $1 == -h ]]; then
- echo "usage: scan [<resolution> [<format> [<extra name>]]]"
- exit
-fi
-
-resolution=${1:-200}
-format=${2:-jpg}
-extra=$3
-
-if [[ -n $extra ]]; then
- extra="_$extra"
-fi
-
-file="scan_$(date +%Y-%m-%d_%H%M%S)${extra}.${format}"
-
-scanimage -x 214.98 -y 294.973 --resolution $resolution | convert - "$file"
diff --git a/watchdog.sh b/watchdog.sh
deleted file mode 100755
index 72f628d..0000000
--- a/watchdog.sh
+++ /dev/null
@@ -1,198 +0,0 @@
-#!/bin/bash
-#----------------------------------------------------
-# Version: 0.1.7.0
-# Author: Florian "Bluewind" Pritz <flo@xssn.at>
-#
-# Licensed under WTFPL v2
-# (see COPYING for full license text)
-#
-#----------------------------------------------------
-# Script to check if services are working and take
-# actions if not
-#----------------------------------------------------
-# NOTE:
-# Format for service file
-# <IP or hostname> <service name>
-
-#-------------------------- CONFIGURATION -----------------------------#
-# Time to wait between 2 checks; Shouldn't be lower than 10 as that
-# could cause overlap with the timeouts
-WAIT=30
-
-# Take action after x faild checks
-MAX_FAIL=2
-
-# set to /dev/null if you don't want logs
-LOGFILE="$HOME/watchdog.log"
-
-# Paths (Shouldn't need to be changed)
-CURL="/usr/bin/curl"
-WGET="/usr/bin/wget"
-PING="/bin/ping"
-#----------------------------------------------------------------------#
-
-SCRIPTNAME=$(basename $0)
-
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_ERROR=2
-EXIT_BUG=10
-
-DEBUG=0
-
-# Colors for output
-red='\e[0;31m'
-RED='\e[1;31m'
-green='\e[0;32m'
-GREEN='\e[1;32m'
-blue='\e[0;34m'
-BLUE='\e[1;34m'
-cyan='\e[0;36m'
-CYAN='\e[1;36m'
-NC='\e[0m'
-
-function usage {
- echo -e "${blue}Usage:${NC} ${SCRIPTNAME} [OPTIONS]" >&2
- echo -e "Possible service types: http, ping (default)"
- echo -e "Options:" >&2
- echo -e "-h this help" >&2
- echo -e "-d debug output" >&2
- echo -e "-f <file> loads IP list from a file" >&2
- echo -e "-t <time> Time between 2 checks"
- echo -e "-m <tries> Max. fails before taking actions"
- [[ $# -eq 1 ]] && exit $1 || exit $EXIT_FAILURE
-}
-
-dbg() {
- if [[ $DEBUG -gt 0 ]]; then
- echo "$@" >&2
- fi
-}
-
-if [ ! -f "$CURL" ]; then
- if [ ! -f "$WGET" ]; then
- echo -e "${red}Wget doesn't exist!$NC"
- exit $EXIT_ERROR
- fi
- HTTP="$WGET -t 2 -T 1 -O /dev/null"
-else
- HTTP="$CURL --connect-timeout 1 --retry 2 -O /dev/null"
-fi
-
-if [ ! -f "$PING" ]; then
- echo -e "${red}Ping command doesn't exist! Please fix the path.$NC"
- exit $EXIT_ERROR
-else
- PING="$PING -c 1 -W 1"
-fi
-
-if [ ! "$1" ] && [ ! "$2" ]; then
- usage $EXIT_SUCCESS
-fi
-
-while getopts ':f:hdt:m:' OPTION ; do
- case $OPTION in
- f)
- IPFILE="$OPTARG"
- ;;
- t)
- WAIT="$OPTARG"
- ;;
- m)
- MAX_FAIL="$OPTARG"
- ;;
- h)
- usage $EXIT_SUCCESS
- ;;
- d)
- DEBUG=1
- ;;
- \?)
- echo "Unknown option \"-$OPTARG\"." >&2
- usage $EXIT_ERROR
- ;;
- :)
- echo "Option \"-$OPTARG\" needs an argument" >&2
- usage $EXIT_ERROR
- ;;
- *)
- echo "This shouldn't happen, please file a bugreport.">&2
- usage $EXIT_BUG
- ;;
- esac
-done
-
-
-shift $(( OPTIND - 1 ))
-
-watcher () {
- IP="$1"
- TYPE="$2"
- WAIT="$3"
-
- dbg "watcher: $IP - $TYPE - $WAIT"
-
- case "$TYPE" in
- http) COMMAND="$HTTP";;
- *) COMMAND="$PING";;
- esac
-
- counter=0
-
- while :;
- do
- precmd_time=$(date +%s)
- $COMMAND $IP &> /dev/null
- exitcode=$?
- if [ "$exitcode" -ne "0" ]; then
- if [ "$counter" -lt "1" ]; then
- downtime=`date`
- fi
- let counter=$counter+1
- if [ "$counter" -eq $MAX_FAIL ]; then
- mail $USER -s "$IP - $TYPE DOWN! " <<< "$IP - $TYPE is down since $downtime
-$(tracepath $IP)"
- dbg "$IP - $TYPE down since $downtime"
- fi
- else
- if [ "$counter" -gt $MAX_FAIL ] || [ "$counter" -eq $MAX_FAIL ]; then
- mail $USER -s "$IP - $TYPE UP! " <<< "$IP - $TYPE is OK again.
- Downtime: ${downtime} - $(date)"
- dbg "$IP - $TYPE up again $(date)"
- echo "$IP - $TYPE Downtime: ${downtime} - $(date)" >> $LOGFILE
- fi
- counter=0
- fi
- current_time=$(date +%s)
- processing_time=`expr ${current_time} - ${precmd_time}`
- sleeptime=`expr ${WAIT} - ${processing_time}`
- if [ "${sleeptime}" -lt "1" ]; then
- sleeptime=0
- fi
- sleep ${sleeptime}
- done
-}
-
-# stops watchers and exits
-cleanup() {
- dbg "cleaning up..."
- kill $jobs &> /dev/null
- exit
-}
-trap cleanup 2 15
-
-# start watchers
-while read line
-do
- watcher $line &
-done < $IPFILE
-
-# Prepare killing all watchers
-jobs=$(jobs -p)
-disown -ar
-
-echo "Press ^C to kill"
-while :; do
- sleep 999
-done
-