diff options
author | Patrick Simianer <p@simianer.de> | 2016-04-14 17:30:30 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-04-14 17:30:30 +0200 |
commit | 3c1b8d5c8947bf0aa3e929c21f59eaf06aba33af (patch) | |
tree | 71111c40dd00a4739c53413f5926a26bbe901ead | |
parent | 2c01777eb98ac7649d24e1a60a94393892b7e7af (diff) |
more general monitor_soft_raid
-rwxr-xr-x | aptitude_safe_upgrade | 7 | ||||
-rwxr-xr-x | backup_2pac | 9 | ||||
-rw-r--r-- | backup_2pac.exclude | 10 | ||||
-rwxr-xr-x | crypt_make (renamed from make_crypt) | 0 | ||||
-rwxr-xr-x | crypt_mount (renamed from mount_crypt) | 0 | ||||
-rwxr-xr-x | crypt_umount (renamed from umount_crypt) | 0 | ||||
-rwxr-xr-x | duplicates (renamed from dup) | 0 | ||||
-rwxr-xr-x | find_by_keyword | 7 | ||||
-rwxr-xr-x | fn_f7 | 10 | ||||
-rwxr-xr-x | forward_ports | 7 | ||||
-rwxr-xr-x | hibernate | 9 | ||||
-rwxr-xr-x | hosts_file | 7 | ||||
-rwxr-xr-x | jpegrotate | 10 | ||||
-rwxr-xr-x | kill_wifi | 5 | ||||
-rwxr-xr-x | monitor_cpu_temp (renamed from temp_cpu) | 0 | ||||
-rwxr-xr-x | monitor_hdd_temp (renamed from temp_hdd) | 0 | ||||
-rwxr-xr-x | monitor_soft_raid (renamed from mdstat) | 0 | ||||
-rwxr-xr-x | pdf2png | 226 | ||||
-rwxr-xr-x | remote-home | 4 | ||||
-rwxr-xr-x | stopwatch | 56 | ||||
-rwxr-xr-x | strip-tags | 47 | ||||
-rw-r--r-- | suspend | 4 | ||||
-rwxr-xr-x | thinkwatt | 304 | ||||
-rwxr-xr-x | tk_bbl.py | 25 | ||||
-rwxr-xr-x | up_pdf | 5 | ||||
-rwxr-xr-x | up_pdflatex | 10 | ||||
-rwxr-xr-x | xfs-raid | 47 | ||||
-rwxr-xr-x | youtube_mp3 | 20 |
28 files changed, 0 insertions, 829 deletions
diff --git a/aptitude_safe_upgrade b/aptitude_safe_upgrade deleted file mode 100755 index ead0c8d..0000000 --- a/aptitude_safe_upgrade +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/zsh - -. /home/pks/bin/func.zsh -check_root - -aptitude update && aptitude safe-upgrade -y - diff --git a/backup_2pac b/backup_2pac deleted file mode 100755 index b57abe9..0000000 --- a/backup_2pac +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/zsh - -. /home/pks/bin/func.zsh -check_root - -logger RSYNC BACKUP START -rsync -avv --delete --exclude-from /home/pks/bin/backup_2pac.exclude / /workspace/.b &>/var/log/backup.log -logger RSYNC BACKUP END - diff --git a/backup_2pac.exclude b/backup_2pac.exclude deleted file mode 100644 index 571287a..0000000 --- a/backup_2pac.exclude +++ /dev/null @@ -1,10 +0,0 @@ -/dev -/media -/mnt -/proc -/run -/sys -/tmp -/toolbox -/var -/workspace diff --git a/mount_crypt b/crypt_mount index 2483aec..2483aec 100755 --- a/mount_crypt +++ b/crypt_mount diff --git a/umount_crypt b/crypt_umount index 5743731..5743731 100755 --- a/umount_crypt +++ b/crypt_umount diff --git a/find_by_keyword b/find_by_keyword deleted file mode 100755 index 93bf851..0000000 --- a/find_by_keyword +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/zsh - -for i in `find . -type f`; do - A=$(jhead $i 2>/dev/null | grep Keyword | grep $1) - if [ "$A" != "" ]; then echo $i; fi -done - @@ -1,10 +0,0 @@ -#!/bin/sh - -if [ -a /tmp/vgaclone ]; then - xrandr --output VGA-0 --off - rm /tmp/vgaclone -else - xrandr --output VGA-0 --mode 1024x768 - touch /tmp/vgaclone -fi - diff --git a/forward_ports b/forward_ports deleted file mode 100755 index c991a0f..0000000 --- a/forward_ports +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/zsh - -. /home/pks/bin/func.zsh -check_root - -iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000 - diff --git a/hibernate b/hibernate deleted file mode 100755 index 3fc0115..0000000 --- a/hibernate +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/zsh -x - -swapoff -a -rm -f /swapfile -dd if=/dev/zero of=/swapfile bs=1M count=2048 -mkswap /swapfile -swapon /swapfile -/usr/sbin/s2disk - diff --git a/hosts_file b/hosts_file deleted file mode 100755 index 2928319..0000000 --- a/hosts_file +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/zsh - -cd /tmp -rm hosts -wget http://someonewhocares.org/hosts/zero/hosts -cat /etc/hosts.mine /tmp/hosts > /etc/hosts - diff --git a/jpegrotate b/jpegrotate deleted file mode 100755 index ee7c3a8..0000000 --- a/jpegrotate +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# src http://www.zmatt.net/files/jpegrotate - -for file in $* -do - echo $file - rotate=`jhead $file |grep '^Orientation : rotate [0-9]\+$' | sed 's/^Orientation : /-/'`; - jpegtran $rotate -optimize -copy all $file >$file.tmp && mv $file.tmp $file -done - diff --git a/kill_wifi b/kill_wifi deleted file mode 100755 index d076c37..0000000 --- a/kill_wifi +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -sudo /etc/init.d/dhcpcd stop -sudo killall wpa_supplicant - diff --git a/temp_cpu b/monitor_cpu_temp index 90b2bc9..90b2bc9 100755 --- a/temp_cpu +++ b/monitor_cpu_temp diff --git a/temp_hdd b/monitor_hdd_temp index 250c34c..250c34c 100755 --- a/temp_hdd +++ b/monitor_hdd_temp diff --git a/mdstat b/monitor_soft_raid index fc86d3a..fc86d3a 100755 --- a/mdstat +++ b/monitor_soft_raid diff --git a/pdf2png b/pdf2png deleted file mode 100755 index 0676440..0000000 --- a/pdf2png +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/bash -############################################################################### -# # -# Martin Bruchanov, bruxy at regnet dot cz # -# # -# http://bruxy.regnet.cz/ # -# # -# Version: 1.2 (Fri Jul 20 13:17:18 CEST 2012) # -# # -############################################################################### - -## Defaults -DEFAULT_DPI=300 # default output dpi -GS_DPI=300 # gs will rasterize to this size, before resizing -UNSHARP_RADIUS=1.0 # bitmap enhancing with unsharp mask -COLORS=16777216 # default num. of colors, use 16, 256,... - -## Global variables -PAGE_START=1 -PAGE_STOP=1 -WIDTH=0 -HEIGHT=0 -PAGE=0 -ALL=0 - -## Help -print_help(){ - echo "PDF2PNG" - echo "Usage: " `basename $0` [OPTIONS] FILE - echo - echo "Options:" - echo " -h ... this help" - echo " -a ... convert all pages" - echo " -f N ... from page number N" - echo " -t N ... to page number N" - echo " -p N ... only page N (default N = 1)" - echo " -d N ... resolution in dpi (default N = $DEFAULT_DPI)" - echo " -x N ... bitmap width in pixel (if y not given, save aspect ratio)" - echo " -y N ... bitmap height in pixel (if x not given, save aspect ratio)" - echo " -u N ... unsharp radius (default N = $UNSHARP_RADIUS)" - echo " -c N ... number of colors (default N = $COLORS)" - echo -} - -# definition of color escape sequences for ANSI terminal -RED="\033[01;31m" -GREEN="\033[01;32m" - -color_echo(){ -# 1 -- color escape sequncy -# 2 -- string -# \033[0m -- reset color settings - echo -e "$1 $2 \033[0m" -} - - -test_return(){ -# 1 -- return code $? -# 2 -- description of operation -echo -e -n $2: -COL=40 -# move cursor to column $COL -echo -en "\033[${COL}G" -if [ $1 -eq 0 ] -then - color_echo $GREEN OK -else - color_echo $RED FALSE - exit 1 -fi -} - -if [ $# -lt 1 ] # print help -then - print_help - exit 1 -fi - -## Process CLI - -while getopts "af:t:d:hx:y:w:u:p:c:" name -do - case $name in - a) ALL=1 - ;; - f) PAGE_START=$OPTARG - ;; - t) PAGE_STOP=$OPTARG - ;; - p) PAGE=$OPTARG - ;; - d) DEFAULT_DPI=$OPTARG - ;; - x) WIDTH=$OPTARG - ;; - y) HEIGHT=$OPTARG - ;; - u) UNSHARP_RADIUS=$OPTARG - ;; - c) COLORS=$OPTARG - ;; - h) # help - print_help - exit 0 - ;; - \?) - echo "Invalid option!" - exit 1 - ;; - esac -done - - -shift $(($OPTIND - 1)); - -INPUT=$1 - -OUTPUT=$(basename $INPUT .pdf) - -echo "Input file: $INPUT" - -## Check all input parameters and set options - -if [ -z "$INPUT" ] -then - echo "No input file!" - exit 1 -fi - -# All pages processing - -MAX_PAGE=`pdfinfo "$INPUT" | grep Pages | awk '{ print $2}'` - -if [ -z $MAX_PAGE ]; then exit; fi - -if [ $ALL -eq 1 ] -then - PAGE_START=1 - PAGE_STOP=$MAX_PAGE -fi - -# Page range processing - -if [ $PAGE_START -gt 1 ] -then - if [ $PAGE_STOP -eq 1 ] - then - PAGE_STOP=$MAX_PAGE - fi -fi - -if [ $PAGE_STOP -gt 1 ] -then - if [ $PAGE_START -eq 1 ] - then - PAGE_START=1 - fi -fi - -if [ $PAGE -gt 0 ] -then - PAGE_START=$PAGE - PAGE_STOP=$PAGE -fi - -# Image size - -if [ $WIDTH -gt 0 ] -then - if [ $HEIGHT -gt 0 ] - then - RESIZE=${WIDTH}x${HEIGHT}\! - else - RESIZE=${WIDTH}x - fi - DEFAULT_DPI=0 -fi - -if [ $HEIGHT -gt 0 ] -then - if [ $WIDTH -gt 0 ] - then - RESIZE=${WIDTH}x${HEIGHT}\! - else - RESIZE=x${HEIGHT} - fi - DEFAULT_DPI=0 -fi - -if [ $DEFAULT_DPI -gt 0 ] -then - RESIZE=$(((DEFAULT_DPI*100)/GS_DPI))"%" -fi - -echo $RESIZE -#exit - -############################################################################## - -echo "Rasterizing pages from $PAGE_START to $PAGE_STOP." -echo "Output image size: $RESIZE" - -j=1 -N=$((PAGE_STOP-PAGE_START+1)) -for i in `seq $PAGE_START $PAGE_STOP` -do - i=`printf %04u $i` - echo "Processing page no. $i ($j/$N)" - TMP=/tmp/tmp-${i}.png - gs -q -sDEVICE=png16m -dBATCH -dNOPAUSE \ - -dFirstPage=$i -dLastPage=$i -r$GS_DPI \ - -sOutputFile=$TMP "$INPUT" > /dev/null 2>&1 - - test_return $? "GhostScript conversion" - - convert \ - -unsharp "$UNSHARP_RADIUS" \ - -resize "${RESIZE}" \ - -colors $COLORS +dither \ - $TMP png:${OUTPUT}_${i}.png - - rm -f $TMP - : $((j++)) -done - - diff --git a/remote-home b/remote-home deleted file mode 100755 index d17e938..0000000 --- a/remote-home +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -sshfs simianer@diddley:/srv/nfs/home_mitarb/simianer/ /mnt -o idmap=user -o uid=1337 -o gid=100 - diff --git a/stopwatch b/stopwatch deleted file mode 100755 index 7ca02d9..0000000 --- a/stopwatch +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# sets stdin to no echo and give a char every tenth of a sec. -stty -echo -icanon time 1 <&0 - -chkspace () { - - if ! read -t 0 ; then return 1 ; fi # no char pressed - read -n 1 ans - if [ "$ans" = " " ]; then return 0 ; fi - case "$ans" in - r|R) COUNT=0 ; BEGIN=$(date +%s) - printf "\r%3d Days, %02d:%02d:%02d" 0 0 0 0 - ;; - q|Q) stty echo icanon <&0 - echo "" - exit 0 - ;; - [1-9]) echo " - $ans" ;; - esac - return 1 -} - -echo "Stopwatch: to start and stop press the SPACEBAR..." - -printf "\r%3d Days, %02d:%02d:%02d" 0 0 0 0 - -COUNT=0 -IFS= -while true ; do - - while true; do - if chkspace ; then break; fi - sleep 0.1 - done - - BEGIN=$(date +%s) - while true; do - NOW=$(date +%s) - let DIFF=$(($NOW - $BEGIN + $COUNT)) - - let MINS=$(($DIFF / 60)) - let SECS=$(($DIFF % 60)) - let HOURS=$(($DIFF / 3600)) - let DAYS=$(($DIFF / 86400)) - - # \r is a "carriage return" - returns cursor to start of line - printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS - - if chkspace ; then break; fi - sleep 0.1 - done - - COUNT=$DIFF -done - diff --git a/strip-tags b/strip-tags deleted file mode 100755 index 62c9511..0000000 --- a/strip-tags +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Script name: strip-tags.sh -# Original Author: Ian of DarkStarShout Blog -# Site: http://darkstarshout.blogspot.com/ -# Options slightly modified to liking of SavvyAdmin.com - -oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TCOM TPOS" - -indexfile=`mktemp` - -#Determine tags present: -find . -iname "*.mp3" -exec eyeD3 --no-color -v {} \; > $indexfile -tagspresent=`sort -u $indexfile | awk -F\): '/^<.*$/ {print $1}' \ -| uniq | awk -F\)\> '{print $1}' | awk -F\( '{print $(NF)}' \ -| awk 'BEGIN {ORS=" "} {print $0}'` - -rm $indexfile - -#Determine tags to strip: -tostrip=`echo -n $tagspresent $oktags $oktags \ -| awk 'BEGIN {RS=" "; ORS="\n"} {print $0}' | sort | uniq -u \ -| awk 'BEGIN {ORS=" "} {print $0}'` - -#Confirm action: -echo -echo The following tags have been found in the mp3s: -echo $tagspresent -echo These tags are to be stripped: -echo $tostrip -echo -echo -n Press enter to confirm, or Ctrl+C to cancel... -read dummy - -#Strip 'em -stripstring=`echo $tostrip \ -| awk 'BEGIN {FS="\n"; RS=" "} {print "--set-text-frame=" $1 ": "}'` - -# First pass copies any v1.x tags to v2.3 and strips unwanted tag data. -# Second pass removes v1.x tags, since I don't like to use them. -# Without --no-tagging-time-frame, a new unwanted tag is added. :-) - -find . -iname "*.mp3" \ --exec eyeD3 --to-v2.3 --no-tagging-time-frame $stripstring {} \; \ --exec eyeD3 --remove-v1 --no-tagging-time-frame {} \; - -echo "Script complete!" - diff --git a/suspend b/suspend deleted file mode 100644 index 39f2914..0000000 --- a/suspend +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/zsh -x - -/usr/bin/s2ram - diff --git a/thinkwatt b/thinkwatt deleted file mode 100755 index aa408b9..0000000 --- a/thinkwatt +++ /dev/null @@ -1,304 +0,0 @@ -#!/bin/bash -# -# thinkwatt: -# record power consumption, calculate average and create a gnuplot graph -# -# TO-DO: -# * add more options (e.g. for specifying a different gnuplot title or png output) -# * allow time input in minutes and hours - -# utilities {{{ -message() { - cat << EOF -usage: thinkwatt -r (seconds) (-q) (-o file) - thinkwatt [ -p | -a ] (-q) file - -options: - -r, --record record power consumption and optionally create a graph from the gathered data - -p, --plot create a plot image from a specified data file - -a, --average calculate the average power consumption from a specified data file - -q, --quiet makes thinkwatt less chatty - -o, --output the output file. can be prepended by a path. - -h, --help show this help text - -examples: - thinkwatt -r (will record to a temp file until cancelled) - thinkwatt -r 300 -o /foo/bar/consumption.dat (will record for 5 minutes to the specified file) - thinkwatt -p /foo/bar/consumption.dat (will create a graph from the specified file) -EOF - exit 1 -} - -errorout() { echo "error: $*" >&2; exit 1; } - -check_ac() { - [[ "$quiet" ]] && return 0 - [[ $(cat /sys/class/power_supply/*/online) = 0 ]] || echo 'it seems your AC adapter is plugged in' -} -check_datafile() { - [[ -f "$@" ]] || errorout "$@ does not exist" - local valid_file=$(file "$@" | grep -s "^$@: ASCII text$") - [[ "$valid_file" ]] || errorout "$@ is not a valid data file" - local valid_data=$(cat "$@" | grep -s '^[0-9]*[,.]\?.*[0-9]$') - [[ "$valid_data" ]] || errorout "$@ does not contain valid data" -} -countdown() { - [[ "$quiet" ]] || echo "ctrl+c to plot/exit" - if [[ "$seconds" =~ ^[0-9]+$ ]];then - # count down - secs="$seconds" - while [ "$secs" -gt 0 ];do - [[ "$die" == yes ]] && return 0 - sleep 1 & - cat "$powerfile" >> "$tmpfile1" - printf "\rrecording (%02d/$seconds)" $((secs)) - secs=$(( $secs - 1 )) - wait - done - else - # count up - secs=1 - while true;do - [[ "$die" == yes ]] && return 0 - sleep 1 & - cat "$powerfile" >> "$tmpfile1" - printf "\rrecording ($secs)" - secs=$(( $secs + 1 )) - wait - done - fi - echo -} -# if we abort the recording process with ctrl+c this will give the option to plot the already recorded data -trap ctrl_c INT -function ctrl_c() { - echo - read -p "plot data? y/n " - [[ "$REPLY" = "y" ]] && die=yes || exit 0 -} -# }}} - -# default output dir and png file {{{ -# use $TDIR to have thinkwatt save files in a different directory. -# thinkwatt will save two files: -# 1) a .plt file (containing plot instructions) in case you want to reuse/modify it -# 2) a .png file (the plot graphic) -TDIR="/tmp/thinkwatt" -PLOTFILE="$TDIR"/$$.plt -# }}} - -# record {{{ -record() { - - local seconds="$1" - - #[[ "$seconds" =~ ^[0-9]+$ ]] || errorout 'please specify the time in seconds" - [[ -d "$output" ]] && errorout "$output is a directory" - [[ -d "$TDIR" ]] || mkdir -p "$TDIR" 2>/dev/null || errorout "could not create $TDIR" - - if [[ -f "$output" ]];then - read -p "overwrite $output? y/n " - [[ "$REPLY" = "y" ]] || exit 0 - elif [[ -e "$output" ]];then - errorout "$output exists and can/should not be written to" - fi - - local tmpfile1=/tmp/$$.dat - local tmpfile="$TDIR"/$$.dat - - if [[ "$output" ]];then - local dir=$(dirname "$output") - local file=$(basename "$output") - [[ -d "$dir" ]] || mkdir -p "$dir" - [[ -w "$dir" ]] || errorout "you don't have permissions to write to $dir" - - outputfile="$output" - [[ "$dir" ]] && TDIR="$dir" - PNGFILE="$TDIR"/$(basename "$file" .dat).png - #PLOTFILE="$TDIR"/$(basename "$output" .dat).plt - else - [[ -w "$(pwd)" ]] || errorout "you don't have permissions to write to $(pwd)" - local file=$(basename "$tmpfile") - outputfile="$tmpfile" - local istemp=true - fi - - SMAPI=$(lsmod | grep -s tp_smapi) - if [[ "$SMAPI" ]];then - local powerfile=/sys/devices/platform/smapi/BAT0/power_now - else - echo "for more accurate results with thinkpads use tp_smapi" - local powerfile=/sys/class/power_supply/BAT0/power_now - fi - - touch "$tmpfile1" || errorout "could not create $tmpfile1" - trap "rm $tmpfile1" EXIT - - # do the actual recording included in countdown() - countdown - - # file formatting - if [[ "$SMAPI" ]];then - # we strip the leading "-" from the data file - sed -i 's/-//g' "$tmpfile1" - else - # strip the trailing last 3 characters - sed -i 's/.\{3\}$//' "$tmpfile1" - fi - # and divide by 1000 to convert from mW to W - cat "$tmpfile1" | awk '{print $1/1000}' > "$tmpfile" - - [[ "$output" ]] && mv "$tmpfile" "$output" - - [[ "$quiet" ]] || echo average was $(average "$outputfile") W - - plot "$outputfile" - -} -# }}} - -# calculate average {{{ -average() { - - [[ "$@" ]] || errorout 'please specify a file to read from.' - [[ -f "$@" ]] || errorout 'file not found.' - check_datafile "$@" - - awk 'BEGIN{s=0;}{s+=($1);}END{print s/NR;}' "$@" - -} -# }}} - -# make the plot file {{{ -makeplotfile() { - - cat << EOF -# gnuplot file -# created by thinkwatt -# $DATE - -set title "$TITLE" -set xlabel "$XLABEL" -set ylabel "$YLABEL" -set terminal $TERMINAL -set output "$PNGFILE" -EOF - [[ "$YRANGE" ]] && echo "set yrange $YRANGE" - [[ "$XRANGE" ]] && echo "set yrange $YRANGE" - [[ "$GRID" == yes ]] && echo "set grid" - [[ "$YTICS" ]] && echo "set ytics $YTICS" - [[ "$MYTICS" ]] && echo "set mytics $MYTICS" - [[ "$XTICS" ]] && echo "set xtics $XTICS" - [[ "$MXTICS" ]] && echo "set mxtics $MXTICS" - [[ "$GRIDSET" ]] && echo "set grid $GRIDSET" - - echo - if [[ "$TITLE1" ]];then - echo "plot \"$datafile\" using (\$1) with lines title \"$TITLE1\" lt 2, \\" - else - echo "plot \"$datafile\" using (\$1) with lines lt 2, \\" - fi - - if [[ "$TITLE2" ]];then - if [[ "$avg" ]];then - echo "\"$datafile\" using (\$1) smooth bezier title \"$TITLE2\" lt 1, \\" - else - echo "\"$datafile\" using (\$1) smooth bezier title \"$TITLE2\" lt 1" - fi - else - if [[ "$avg" ]];then - echo "\"$datafile\" using (\$1) smooth bezier lt 1, \\" - else - echo "\"$datafile\" using (\$1) smooth bezier lt 1" - fi - fi - - [[ "$avg" ]] && echo "$avg title \"$file (average, $avg W)\"" - -} -# }}} - -# do the plotting -plot() { - - # check if we have gnuplot and $TDIR is present - have_gnuplot=$(find $(sed 's/:/ /g' <<<$PATH) 2>/dev/null | grep -is gnuplot) - [[ "$have_gnuplot" ]] || errorout 'please install gnuplot first' - [[ -d "$TDIR" ]] || mkdir -p "$TDIR" || errorout "could not create $TDIR" - - # is input file a valid data file? - local datafile="$@" - check_datafile "$datafile" - [[ "$datafile" ]] || errorout 'please specify a file to read from.' - [[ -f "$datafile" ]] || errorout 'filplotfilee not found.' - - # define some of the variables for the plot file - DATE=$(date +%Y-%m-%d,\ %T) - TITLE="power consumption of my laptop, created by thinkwatt on $DATE" - XLABEL="sec (seconds)" - YLABEL="W (Watt)" - TERMINAL="png" - GRID=yes - #TITLE1="your custom title for line1" - #TITLE2="your custom title for line2" - #TITLE3="your custom title for line3" - # some more options for gnuplot, enable and modify them here if you like - MYTICS=2 - MXTICS=2 - #YTICS=1 - #XTICS=(better leave this alone) - GRIDSET="mytics" - #YRANGE="[4000:16000]" - #XRANGE="[0:2000]" - # moar - local avg=$(average "$datafile" | cut -c1-4) - local dir=$(dirname "$datafile") - local file=$(basename "$datafile") - [[ -z "$TITLE1" ]] && local TITLE1="$file (actual)" - [[ -z "$TITLE2" ]] && local TITLE2="$file (trend)" - [[ "$PNGFILE" ]] || PNGFILE=$(basename "$datafile" .dat).png - - # now we can plot - makeplotfile > "$PLOTFILE" || errorout "could not write the plotfile (permission issue?)" - gnuplot "$PLOTFILE" || errorout "could now write graph (permission issue?)" - - [[ "$quiet" ]] || echo "graph saved as $PNGFILE" - -} - -# parse options {{{ -parse_options() { - - [[ -z "$1" ]] && message - - while [[ -n "$1" ]];do - case "$1" in - -h|--help) message ;; - -q|--quiet) quiet=true ;; - -o|--output) output="$2" ;; - -r|--record) mode='record' ;; - -p|--plot) mode='plot' ;; - -a|--average) mode='average' ;; - *) args+=( "$1" ) ;; - esac - shift - done -} -# }}} - -# main {{{ -main() { - - case "$mode" in - record) record "${args[@]}" ;; - average) average "${args[@]}" ;; - plot) plot "${args[@]}" ;; - *) errorout 'invalid mode. use -r, -p or -a.' ;; - esac - -} -# }}} - -parse_options "$@" -check_ac -main diff --git a/tk_bbl.py b/tk_bbl.py deleted file mode 100755 index f7ed30f..0000000 --- a/tk_bbl.py +++ /dev/null @@ -1,25 +0,0 @@ -import time, mechanize, re, random - -browser = mechanize.Browser() -browser.set_handle_robots(False) -browser.set_handle_refresh(False) -browser.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0')] - -rand = random.randrange(1000000000,9999999999) -time = int(time.time()) -state = str(time) + str(rand); - -browser.open("https://www.telekombasketball.de") -browser.open("https://accounts.login.idm.telekom.com/oauth2/auth?response_type=code&client_id=10LIVESAM30000004901BEKOBBL0000000000000&scope=openid&redirect_uri=http:%2F%2Fwww.telekombasketball.de%2Foauth.php%3Frequest%3Dlogin%26headto%3Dhttp:%2F%2Fwww.telekombasketball.de%2F&state="+state+"&claims=%7B%22id_token%22%3A%7B%22urn%3Atelekom.com%3Aall%22%3Anull%7D%7D") - -user = "" -password = "" -browser.select_form(name="login") -browser.form['pw_usr'] = user -browser.form['pw_pwd'] = password -browser.submit() - -browser.open("https://www.telekombasketball.de/videoplayer/player.php?play=" + str(2731)) -response = browser.response().read() -mobileUrl = re.search('mobileUrl: \"(.*?)\"', response).group(1) -print mobileUrl @@ -1,5 +0,0 @@ -#!/bin/zsh - -mupdf $1 & -echo $! > .mupdf.pid - diff --git a/up_pdflatex b/up_pdflatex deleted file mode 100755 index b9b141b..0000000 --- a/up_pdflatex +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -/usr/bin/pdflatex $1 - -if [ $? -eq 0 ]; then -if [ -e .mupdf.pid ]; then - kill -1 $(cat .mupdf.pid) -fi -fi - diff --git a/xfs-raid b/xfs-raid deleted file mode 100755 index 97ee225..0000000 --- a/xfs-raid +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -BLOCKSIZE=512 # Make sure this is in bytes -CHUNKSIZE=128 # Make sure this is in KiB -NUMSPINDLES=3 -RAID_TYPE=5 -RAID_DEVICE_NAME="/dev/md0" # Specify device name for your RAID device -FSLABEL="name" # specify filesystem label for generating mkfs line here - -case "$RAID_TYPE" in -0) - RAID_DISKS=${NUMSPINDLES}; - ;; -1) - RAID_DISKS=${NUMSPINDLES}; - ;; -10) - RAID_DISKS=${NUMSPINDLES}; - ;; -5) - RAID_DISKS=`echo "${NUMSPINDLES} - 1" | bc`; - ;; -6) - RAID_DISKS=`echo "${NUMSPINDLES} - 2" | bc`; - ;; -*) - echo "Please specify RAID_TYPE as one of: 0, 1, 10, 5, or 6." - exit - ;; -esac - -SUNIT=`echo "${CHUNKSIZE} * 1024 / 512" | bc` -SWIDTH=`echo "$RAID_DISKS * ${SUNIT}" | bc` - -echo "System blocksize=${BLOCKSIZE}" -echo "Chunk Size=${CHUNKSIZE} KiB" -echo "NumSpindles=${NUMSPINDLES}" -echo "RAID Type=${RAID_TYPE}" -echo "RAID Disks (usable for data)=${RAID_DISKS}" -echo "Calculated values:" -echo "Stripe Unit=${SUNIT}" -echo -e "Stripe Width=${SWIDTH}\n" -echo "mkfs line:" -echo -e "mkfs.xfs -b size=${BLOCKSIZE} -d sunit=${SUNIT},swidth=${SWIDTH} -L ${FSLABEL} ${RAID_DEVICE_NAME}\n" -echo "mount line:" -echo -e "mount -o remount,sunit=${SUNIT},swidth=${SWIDTH}\n" -echo "Add these options to your /etc/fstab to make permanent:" -echo "sunit=${SUNIT},swidth=${SWIDTH}" diff --git a/youtube_mp3 b/youtube_mp3 deleted file mode 100755 index 4d4904e..0000000 --- a/youtube_mp3 +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/zsh - -usage() -{ - echo "$0 <yt link> <mp3 file>" - exit 1 -} - -if [ -z $1 ] || [ -z $2 ]; then usage; fi - -TMP_FN=/tmp/youtube-dl-$RANDOM -while [ -a $TMP_FN ]; do - TMP_FN=/tmp/youtube-dl-$RANDOM -done -echo $TMP_FN - -youtube-dl --output=$TMP_FN --format=18 "$1" -ffmpeg -i $TMP_FN -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2" -rm $TMP_FN - |