From ca41eddfdc979955105cce572e659941544d6f6d Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 9 Oct 2014 20:44:15 +0100 Subject: alles neu macht der mai --- 256colors | 63 -------------- README.md | 17 ++-- aptitude-safe-upgrade | 7 -- aptitude_safe_upgrade | 7 ++ backup-2pac | 9 -- backup_2pac | 9 ++ blink | 43 ---------- chromium-real-user-agent | 4 - chromium_real_user_agent | 4 + cputemp | 14 ---- dd_bench | 18 ++++ ddbench | 18 ---- ebay-template | 36 -------- ebay_template | 36 ++++++++ find-by-keyword | 7 -- find_by_keyword | 7 ++ fn-f7 | 10 --- fn_f7 | 10 +++ forward-ports | 7 -- forward_ports | 7 ++ func.zsh | 1 - gallery | 42 +++++----- hddtemp | 15 ---- jpegtran-rotate-lossless | 35 -------- jpegtran_rotate_lossless | 35 ++++++++ kill_wifi | 5 ++ killwifi | 5 -- magnet | 6 -- mdstat | 6 -- mount-crypt | 8 -- mount_crypt | 8 ++ net-profile | 18 ---- net_profile | 18 ++++ offlineimap-switch | 11 --- offlineimap_switch | 11 +++ pdflatexup | 10 --- spark | 89 -------------------- strip-tags | 2 +- tatort-dl | 211 ----------------------------------------------- temp_cpu | 15 ++++ temp_hdd | 15 ++++ try-qlogin | 9 -- try_qlogin | 9 ++ umount-crypt | 8 -- umount_crypt | 8 ++ up_pdf | 5 ++ up_pdflatex | 10 +++ updatepdf | 5 -- upgrade-gentoo | 23 ------ upgrade-kernel | 21 ----- upgrade_gentoo | 23 ++++++ upgrade_kernel | 21 +++++ youtube_mp3 | 20 +++++ yt2mp3 | 20 ----- 54 files changed, 330 insertions(+), 751 deletions(-) delete mode 100755 256colors delete mode 100755 aptitude-safe-upgrade create mode 100755 aptitude_safe_upgrade delete mode 100755 backup-2pac create mode 100755 backup_2pac delete mode 100755 blink delete mode 100755 chromium-real-user-agent create mode 100755 chromium_real_user_agent delete mode 100755 cputemp create mode 100755 dd_bench delete mode 100755 ddbench delete mode 100755 ebay-template create mode 100755 ebay_template delete mode 100755 find-by-keyword create mode 100755 find_by_keyword delete mode 100755 fn-f7 create mode 100755 fn_f7 delete mode 100755 forward-ports create mode 100755 forward_ports delete mode 100755 hddtemp delete mode 100755 jpegtran-rotate-lossless create mode 100755 jpegtran_rotate_lossless create mode 100755 kill_wifi delete mode 100755 killwifi delete mode 100755 magnet delete mode 100755 mdstat delete mode 100755 mount-crypt create mode 100755 mount_crypt delete mode 100755 net-profile create mode 100755 net_profile delete mode 100755 offlineimap-switch create mode 100755 offlineimap_switch delete mode 100755 pdflatexup delete mode 100755 spark delete mode 100755 tatort-dl create mode 100755 temp_cpu create mode 100755 temp_hdd delete mode 100755 try-qlogin create mode 100755 try_qlogin delete mode 100755 umount-crypt create mode 100755 umount_crypt create mode 100755 up_pdf create mode 100755 up_pdflatex delete mode 100755 updatepdf delete mode 100755 upgrade-gentoo delete mode 100755 upgrade-kernel create mode 100755 upgrade_gentoo create mode 100755 upgrade_kernel create mode 100755 youtube_mp3 delete mode 100755 yt2mp3 diff --git a/256colors b/256colors deleted file mode 100755 index c97c2be..0000000 --- a/256colors +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -# Author: Todd Larason -# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ - -# use the resources for colors 0-15 - usually more-or-less a -# reproduction of the standard ANSI colors, but possibly more -# pleasing shades - -# colors 16-231 are a 6x6x6 color cube -for ($red = 0; $red < 6; $red++) { - for ($green = 0; $green < 6; $green++) { - for ($blue = 0; $blue < 6; $blue++) { - printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", - 16 + ($red * 36) + ($green * 6) + $blue, - ($red ? ($red * 40 + 55) : 0), - ($green ? ($green * 40 + 55) : 0), - ($blue ? ($blue * 40 + 55) : 0)); - } - } -} - -# colors 232-255 are a grayscale ramp, intentionally leaving out -# black and white -for ($gray = 0; $gray < 24; $gray++) { - $level = ($gray * 10) + 8; - printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", - 232 + $gray, $level, $level, $level); -} - - -# display the colors - -# first the system ones: -print "System colors:\n"; -for ($color = 0; $color < 8; $color++) { - print "\x1b[48;5;${color}m "; -} -print "\x1b[0m\n"; -for ($color = 8; $color < 16; $color++) { - print "\x1b[48;5;${color}m "; -} -print "\x1b[0m\n\n"; - -# now the color cube -print "Color cube, 6x6x6:\n"; -for ($green = 0; $green < 6; $green++) { - for ($red = 0; $red < 6; $red++) { - for ($blue = 0; $blue < 6; $blue++) { - $color = 16 + ($red * 36) + ($green * 6) + $blue; - print "\x1b[48;5;${color}m "; - } - print "\x1b[0m "; - } - print "\n"; -} - - -# now the grayscale ramp -print "Grayscale ramp:\n"; -for ($color = 232; $color < 256; $color++) { - print "\x1b[48;5;${color}m "; -} -print "\x1b[0m\n"; diff --git a/README.md b/README.md index 56963c9..c354bc7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,11 @@ stuff for ~/bin contains code from third-parties: -* 256colors https://github.com/joejulian/xterm/blob/master/vttests/256colors2.pl -* blink http://pikeypl.com/index.php?show=code&menu=software&language=bash&code=blink.sh -* pdf2png http://bruxy.regnet.cz/ -* ratcpi https://github.com/jbaber/ratpoison_scripts -* spark https://github.com/holman/spark -* stopwatch http://www.thelinuxdaily.com/2012/03/simple-stopwatch-script/ -* strip-tags http://savvyadmin.com/strip-all-unwanted-mp3-id3-tags/ -* tatort-dl http://gareus.org/wiki/tatort-dl -* thinkwatt https://github.com/mikar/thinkwatt -* xfs-raid http://www.mythtv.org/wiki/Optimizing_Performance#Optimizing_XFS_on_RAID_Arrays + + * pdf2png http://bruxy.regnet.cz/ + * ratcpi https://github.com/jbaber/ratpoison_scripts + * stopwatch http://www.thelinuxdaily.com/2012/03/simple-stopwatch-script/ + * strip-tags http://savvyadmin.com/strip-all-unwanted-mp3-id3-tags/ + * thinkwatt https://github.com/mikar/thinkwatt + * xfs-raid http://www.mythtv.org/wiki/Optimizing_Performance#Optimizing_XFS_on_RAID_Arrays 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/aptitude_safe_upgrade b/aptitude_safe_upgrade new file mode 100755 index 0000000..ead0c8d --- /dev/null +++ b/aptitude_safe_upgrade @@ -0,0 +1,7 @@ +#!/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 43748fb..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 b/backup_2pac new file mode 100755 index 0000000..43748fb --- /dev/null +++ b/backup_2pac @@ -0,0 +1,9 @@ +#!/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/blink b/blink deleted file mode 100755 index 88c252b..0000000 --- a/blink +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -#_______________________________________________ -# blink.sh - ThinkBlink making ThinkLight blink -# author: Pawel Kazimierowicz www.PiKeyPL.com -#_______________________________________________ -# use: sh blink.sh [how many flashes] [how long flashes] -# eg. sh blink.sh 3 1 - three flashes for one second -# eg. sh blink.sh 2 5 - two flashes for five seconds -# -# http://pikeypl.com/index.php?show=code&menu=software&language=bash&code=blink.sh - - ile=$1; # ile mrugniec, parametr skryptu - i=1; # licznik do petli - -read d < /sys/class/leds/tpacpi\:\:thinklight/brightness #load state of ThinkLight -# when state = 0 - OFF, 255 - ON -# echo $d # print state of ThinkLight - for diagnostic. - -case "$d" in -# if ThinkLight if OFF: ON->OFF - "0") - while [ $i -le $ile ]; do - echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness ; - sleep $2; - echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness; - sleep $2; - i=$((i+1)); - - done;; - -# if ThinkLight is ON: OFF->ON -"255") - while [ $i -le $ile ]; do - echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness; - sleep $2; - echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness; - sleep $2; - i=$((i+1)); - done -esac - -# EOF ThinkBlink by Pawel Kazimierowicz - diff --git a/chromium-real-user-agent b/chromium-real-user-agent deleted file mode 100755 index 3d93034..0000000 --- a/chromium-real-user-agent +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/zsh - -/usr/bin/chromium-browser --no-referrers ${1+"$@"} 2>/dev/null & - diff --git a/chromium_real_user_agent b/chromium_real_user_agent new file mode 100755 index 0000000..3d93034 --- /dev/null +++ b/chromium_real_user_agent @@ -0,0 +1,4 @@ +#!/bin/zsh + +/usr/bin/chromium-browser --no-referrers ${1+"$@"} 2>/dev/null & + diff --git a/cputemp b/cputemp deleted file mode 100755 index 775727c..0000000 --- a/cputemp +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/zsh - -MAX_TEMP=$1 - -for i in \ - /sys/devices/pci0000:00/0000:00:18.3/temp1_input \ - /sys/devices/pci0000:00/0000:00:19.3/temp1_input \ - /sys/devices/pci0000:00/0000:00:1a.3/temp1_input \ - /sys/devices/pci0000:00/0000:00:1b.3/temp1_input; do - TEMP=$(cat $i) - if [ $TEMP -gt $MAX_TEMP ]; then - logger "Some CPU temp @$TEMP (/1000)!" - fi -done diff --git a/dd_bench b/dd_bench new file mode 100755 index 0000000..0db9a46 --- /dev/null +++ b/dd_bench @@ -0,0 +1,18 @@ +#!/bin/sh + +for i in {0..4}; do +echo "WRITE SPEED" +dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc +echo + +echo "READ SPEED" +echo 3 > /proc/sys/vm/drop_caches +dd if=tempfile of=/dev/null bs=1M count=1024 +echo + +echo "BUFFERED READ SPEED" +dd if=tempfile of=/dev/null bs=1M count=1024 + +rm tempfile +done + diff --git a/ddbench b/ddbench deleted file mode 100755 index 0db9a46..0000000 --- a/ddbench +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -for i in {0..4}; do -echo "WRITE SPEED" -dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc -echo - -echo "READ SPEED" -echo 3 > /proc/sys/vm/drop_caches -dd if=tempfile of=/dev/null bs=1M count=1024 -echo - -echo "BUFFERED READ SPEED" -dd if=tempfile of=/dev/null bs=1M count=1024 - -rm tempfile -done - diff --git a/ebay-template b/ebay-template deleted file mode 100755 index 65c6b8f..0000000 --- a/ebay-template +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby - -require 'haml' - -template = ' -%div(style="margin:2em;border:0;background:#ffffcc;font-family:Georgia") - %div(style="margin:1em") - %h1(style="border-bottom:2px solid #fff") - Name - %p(style="margin-left:5%") - Beschreibung - %div(style="margin-left:10%") - %h2 Bilder: - - picCount.times do |i| - %a(href="http://simianer.de/ebay/#{picName}#{i+1}.jpg" target="_blank") - %img(style="border:2px solid blue;float:left;margin:20px;" src="http://simianer.de/ebay/#{picName}#{i+1}t.jpg") - %div(style="clear:left") - %br - %br - %p - Bitte beachten Sie auch meine anderen Artikel!
Ersteigern Sie mehrere Artikel, so zahlen Sie nur 1x Versandkosten. - %h3(style="margin-bottom:0px") - Viel Spaß beim Bieten! :-)' - - -if __FILE__ == $0 - picName = ARGV[0] - picCount = ARGV[1] - - haml_engine = Haml::Engine.new(template) - puts haml_engine.render( - Object.new, - locals={:picName => picName, :picCount => picCount.to_i} - ) -end - diff --git a/ebay_template b/ebay_template new file mode 100755 index 0000000..a5389bb --- /dev/null +++ b/ebay_template @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby + +require 'haml' + +template = ' +%div(style="margin:2em;border:0;background:#ffffcc;font-family:Georgia") + %div(style="margin:1em") + %h1(style="border-bottom:2px solid #fff") + Name + %p(style="margin-left:5%") + Beschreibung + %div(style="margin-left:10%") + %h2 Bilder: + - picCount.times do |i| + %a(href="http://simianer.de/ebay/#{picName}#{i+1}.jpg" target="_blank") + %img(style="border:2px solid blue;float:left;margin:20px;" src="http://simianer.de/ebay/#{picName}#{i+1}t.jpg") + %div(style="clear:left") + %br + %br + %p + Bitte beachten Sie auch meine anderen Artikel!
Ersteigern Sie mehrere Artikel, so zahlen Sie nur 1x Versandkosten. + %h3(style="margin-bottom:0px") + Viel Spaß beim Bieten! :-)' + + +if __FILE__ == $0 + picName = ARGV[0] + picCount = ARGV[1] + + haml_engine = Haml::Engine.new(template) + puts haml_engine.render( + Object.new, + locals={:picName => picName, :picCount => picCount.to_i} + ) +end + 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 - diff --git a/find_by_keyword b/find_by_keyword new file mode 100755 index 0000000..93bf851 --- /dev/null +++ b/find_by_keyword @@ -0,0 +1,7 @@ +#!/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 + diff --git a/fn-f7 b/fn-f7 deleted file mode 100755 index 19d117c..0000000 --- a/fn-f7 +++ /dev/null @@ -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/fn_f7 b/fn_f7 new file mode 100755 index 0000000..19d117c --- /dev/null +++ b/fn_f7 @@ -0,0 +1,10 @@ +#!/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/forward_ports b/forward_ports new file mode 100755 index 0000000..c991a0f --- /dev/null +++ b/forward_ports @@ -0,0 +1,7 @@ +#!/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/func.zsh b/func.zsh index bf5b3d2..470f5db 100644 --- a/func.zsh +++ b/func.zsh @@ -1,4 +1,3 @@ - check_root() { if [ `whoami` != root ]; then echo "Run this script as root, exiting!"; exit; fi diff --git a/gallery b/gallery index 2f89dfa..b92b467 100755 --- a/gallery +++ b/gallery @@ -12,28 +12,28 @@ Patrick Simianer import sys, os, glob, subprocess, shlex def main(): - try: - path = sys.argv[1] - except IndexError: - print 'Usage: gallery.py /path/to/images/' - sys.exit(1) - path += '/' - files = glob.glob(path+'*.jpg') - if not os.path.exists(path+'thumbs'): - os.mkdir(path+'thumbs') - files.sort() - for f in files: - cmd = 'convert "'+f+'" -resize 320x320 "'+path+'thumbs/'+f.split('/')[-1]+'"' - a = shlex.split(cmd) - subprocess.Popen(a) + try: + path = sys.argv[1] + except IndexError: + print 'Usage: gallery.py /path/to/images/' + sys.exit(1) + path += '/' + files = glob.glob(path+'*.jpg') + if not os.path.exists(path+'thumbs'): + os.mkdir(path+'thumbs') + files.sort() + for f in files: + cmd = 'convert "'+f+'" -resize 320x320 "'+path+'thumbs/'+f.split('/')[-1]+'"' + a = shlex.split(cmd) + subprocess.Popen(a) - print '' - print '

Anklicken zum Vergrößern

' - for f in files: - print '
' - print '' - print '
' - print '
' + print '' + print '

Anklicken zum Vergrößern

' + for f in files: + print '
' + print '' + print '
' + print '
' if __name__ == '__main__': main() diff --git a/hddtemp b/hddtemp deleted file mode 100755 index 250c34c..0000000 --- a/hddtemp +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/zsh - -. /home/pks/bin/func.zsh -check_root - -MAX_TEMP=$1 - -for i in `ls -1 /dev/disk/by-id/ | grep -v -P "^wwn-|\-part\d$|md-name|md-uuid"`; do - DRIVE="/dev/disk/by-id/$i" - TEMP=$(/usr/sbin/hddtemp -n $DRIVE 2>/dev/null) - if [ "$TEMP" != "" ]; then - if [ $TEMP -gt $MAX_TEMP ]; then logger "$DRIVE temp at $TEMP"; fi - fi -done - diff --git a/jpegtran-rotate-lossless b/jpegtran-rotate-lossless deleted file mode 100755 index f876e10..0000000 --- a/jpegtran-rotate-lossless +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -function usage { - echo 'Usage: jpegtran-rotate-lossless.sh <90|180|270> ' - exit 1 -} - -ROTATION=$1 -FILE=$2 - -if [ $# -ne 2 ]; then - usage -fi - -case $ROTATION in - 90|180|270) - true ;; - *) - usage ;; -esac - -jpegtran -rotate $ROTATION -trim -copy all $FILE > $FILE-rotate -if [ $? -ne 0 ]; then - echo 'jpegtran-rotate-lossless.sh: jpegtran failed' - exit 1 -fi - -mv $FILE-rotate $FILE -if [ $? -ne 0 ]; then - 'jpegtran-rotate-lossless.sh: mv failed' - exit 1 -fi - -exit 0 - diff --git a/jpegtran_rotate_lossless b/jpegtran_rotate_lossless new file mode 100755 index 0000000..f876e10 --- /dev/null +++ b/jpegtran_rotate_lossless @@ -0,0 +1,35 @@ +#!/bin/sh + +function usage { + echo 'Usage: jpegtran-rotate-lossless.sh <90|180|270> ' + exit 1 +} + +ROTATION=$1 +FILE=$2 + +if [ $# -ne 2 ]; then + usage +fi + +case $ROTATION in + 90|180|270) + true ;; + *) + usage ;; +esac + +jpegtran -rotate $ROTATION -trim -copy all $FILE > $FILE-rotate +if [ $? -ne 0 ]; then + echo 'jpegtran-rotate-lossless.sh: jpegtran failed' + exit 1 +fi + +mv $FILE-rotate $FILE +if [ $? -ne 0 ]; then + 'jpegtran-rotate-lossless.sh: mv failed' + exit 1 +fi + +exit 0 + diff --git a/kill_wifi b/kill_wifi new file mode 100755 index 0000000..d076c37 --- /dev/null +++ b/kill_wifi @@ -0,0 +1,5 @@ +#!/bin/sh + +sudo /etc/init.d/dhcpcd stop +sudo killall wpa_supplicant + diff --git a/killwifi b/killwifi deleted file mode 100755 index d076c37..0000000 --- a/killwifi +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -sudo /etc/init.d/dhcpcd stop -sudo killall wpa_supplicant - diff --git a/magnet b/magnet deleted file mode 100755 index c380cc6..0000000 --- a/magnet +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd ~/tmp -[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit; -echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent" - diff --git a/mdstat b/mdstat deleted file mode 100755 index fc86d3a..0000000 --- a/mdstat +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/zsh - -S=$(awk '/^md/ {printf "%s: ", $1}; /blocks/ {print $NF}' /tmp/wpa_supplicant.log & - sudo /etc/init.d/dhcpcd start - sleep 30 - sudo rc-config start ntp-client -} - -if [ ! -f ~/.net_profiles/$1.conf ]; then - echo "no such profile" - exit -fi - -setup_wifi $1 - - diff --git a/net_profile b/net_profile new file mode 100755 index 0000000..8acea40 --- /dev/null +++ b/net_profile @@ -0,0 +1,18 @@ +#!/bin/sh + +setup_wifi() +{ + sudo wpa_supplicant -D wext -i wlan0 -c ~/.net_profiles/$1.conf &>/tmp/wpa_supplicant.log & + sudo /etc/init.d/dhcpcd start + sleep 30 + sudo rc-config start ntp-client +} + +if [ ! -f ~/.net_profiles/$1.conf ]; then + echo "no such profile" + exit +fi + +setup_wifi $1 + + diff --git a/offlineimap-switch b/offlineimap-switch deleted file mode 100755 index 6f835cd..0000000 --- a/offlineimap-switch +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -case `date +"%a"` in - Sat|Sun) - offlineimap -a private - ;; - *) - offlineimap - ;; -esac - diff --git a/offlineimap_switch b/offlineimap_switch new file mode 100755 index 0000000..6f835cd --- /dev/null +++ b/offlineimap_switch @@ -0,0 +1,11 @@ +#!/bin/sh + +case `date +"%a"` in + Sat|Sun) + offlineimap -a private + ;; + *) + offlineimap + ;; +esac + diff --git a/pdflatexup b/pdflatexup deleted file mode 100755 index b9b141b..0000000 --- a/pdflatexup +++ /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/spark b/spark deleted file mode 100755 index 9041a12..0000000 --- a/spark +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env bash -# -# spark -# https://github.com/holman/spark -# -# Generates sparklines for a set of data. -# -# Here's a a good web-based sparkline generator that was a bit of inspiration -# for spark: -# -# https://datacollective.org/sparkblocks -# -# spark takes a comma-separated list of data and then prints a sparkline out of -# it. -# -# Examples: -# -# spark 1 5 22 13 53 -# # => ▁▁▃▂▇ -# -# spark 0 30 55 80 33 150 -# # => ▁▂▃▅▂▇ -# -# spark -h -# # => Prints the spark help text. - -# Generates sparklines. -# -# $1 - The data we'd like to graph. -spark() -{ - local n numbers= - - # find min/max values - local min=0xffffffff max=0 - - for n in ${@//,/ } - do - # on Linux (or with bash4) we could use `printf %.0f $n` here to - # round the number but that doesn't work on OS X (bash3) nor does - # `awk '{printf "%.0f",$1}' <<< $n` work, so just cut it off - n=${n%.*} - (( n < min )) && min=$n - (( n > max )) && max=$n - numbers=$numbers${numbers:+ }$n - done - - # print ticks - local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █) - - local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) )) - (( f < 1 )) && f=1 - - for n in $numbers - do - echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]} - done - echo -} - -# If we're being sourced, don't worry about such things -if [ "$BASH_SOURCE" == "$0" ]; then - # Prints the help text for spark. - help() - { - cat < -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -RTMPDUMP=${RTMPDUMP:-rtmpdump} -INTERACTIVE= -GETURLONLY= -QUIET= - -while getopts ":Vhigq" opt; do - case $opt in - V) - echo "tator-dl v2013-01-28" - echo - echo "Copyright (C) 2010-2013 Robin Gareus" - echo "This is free software; see the source for copying conditions. There is NO" - echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - h) - echo "tatort-dl - CLI tool for downloading films from http://www.ardmediathek.de/. " - echo - echo "Usage: tatort-dl [-i] [-g] [-q] [OutFileName] " - echo - echo "Wrapper script to parse rtmp and mp4 URLs from the ard-mediathek and launch" - echo "a download using 'rtmpdump'." - echo "The default out-file name is ./format.flv" - echo "-i option: interactive mode - ask before taking any action." - echo "-g option: get URL - just print rtmp URL and exit" - echo "-q option: quiet, inhibit usual output" - echo - echo "Environment:" - echo "RTMPDUMP=rtmpdump" - echo - echo "Example:" - echo "tatort-dl \"http://www.ardmediathek.de/ard/servlet/content/3517136?documentId=3701294\"" - echo - echo "Report bugs to ." - echo "Website http://gareus.org/wiki/tatort-dl" - exit 0 - ;; - q) - QUIET=yes - shift; - ;; - g) - GETURLONLY=yes - QUIET=yes - shift; - ;; - i) - INTERACTIVE=yes - shift; - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac -done - -URL=$(echo -e "$1" | grep "^http") -OUTFILE=$2 - -RTMPDUMPOPTS="" -#RTMPDUMPOPTS+=" --live" -#RTMPDUMPOPTS+=" --resume" -#RTMPDUMPOPTS+=" --quiet" - -if test -z "$URL" ; then - echo -e "Error: missing or invalid parameters\n\nUsage:\n $0 [out-file]\nThe deafult out-file name is ./format.f4v\n\nExample:\n $0 \"http://www.ardmediathek.de/ard/servlet/content/3517136?documentId=3701294\"\n" >&2; - exit 1 -fi - -[[ -z "$QUIET" ]] && echo -en "curl \"$URL\" .." -RTMPURLS=$(curl -s "$URL" | grep -i rtmp) - - -if test -z "$RTMPURLS" ; then - echo -e "\nError: no 'rtmp://' URLs were found on the given Page.\n" >&2 - exit 1; -fi - -COUNT=$(echo -e "$RTMPURLS" | wc -l) -[[ -z "$QUIET" ]] && echo -e " ..found $COUNT RTMP URL(s)." - -urldecode(){ - echo -e "$(sed 'y/+/ /; s/%/\\x/g')" -} - -FLASH=$(echo "$RTMPURLS" | grep flashvars | tail -n1) -if test -n "$FLASH"; then - - RTMPURL=$(echo -ne "$FLASH" \ - | sed 's/^.*streamer=\([^&]*\)&.*$/\1/g' \ - | urldecode) - PLAYPATH=$(echo -ne "$FLASH" \ - | sed 's/^.*file=\([^&]*\)&.*$/\1/g' \ - | urldecode) - #echo "RTMP: $RTMPURL" - #echo "FILE: $PLAYPATH" - -else - - # try high-qualty first - PARAM=$(echo "$RTMPURLS" | grep Web-L) - # fall-back to medium-qualty - if test -z "$PARAM"; then - PARAM=$(echo "$RTMPURLS" | grep Web-M) - fi - # 2nd fall-back: use any rtmp URL - if test -z "$PARAM"; then - PARAM=$(echo "$RTMPURLS" | tail -n 1 ) - fi - - RTMPURL=$(echo -ne "$PARAM" | sed 's/^.*"\(rtmp[t]*:[^"]*\)",.*$/\1/g') - PLAYPATH=$(echo -ne "$PARAM" | sed 's/^.*"\(mp4:[^"]*\)"[),].*$/\1/g') -fi - -test -z "$RTMPURL" && RTMPURL="rtmp://vod.daserste.de/ardfs/" - -if test -n "$GETURLONLY"; then - PLAYPATH2=$(echo -ne "$PLAYPATH" | sed 's/^mp4://g') - echo -n "$RTMPURL$PLAYPATH2" - exit -fi - -if test -z "$OUTFILE"; then - OUTFILE=$(echo -ne "$PLAYPATH" | sed 's/^mp4:.*\/\([^\/?]*\)\?.*$/\1/g') - OUTFILE=$(echo -ne "$OUTFILE" \ - | sed 's/^.*\///g' \ - | sed 's/\?.*$//g' \ - | sed 's/mp4://g' \ - | sed 's/\.f4v$//' \ - | sed 's/\.flv$//'\ - ) - OUTFILE="${OUTFILE}.flv" -fi - -if test -z "$QUIET"; then - echo - echo "Parameters:" - echo " RTMP-URL : $RTMPURL" - echo " Playpath : $PLAYPATH" - echo " Saving to: $OUTFILE" - echo -n " PWD : " - pwd - echo -fi - -if test -z "$PLAYPATH -o -z "$OUTFILE ; then - echo "Error: empty playpath or blank output filename." >&2 - exit 1 -fi - -if test -e "$OUTFILE"; then - echo "WARNING: output file "$OUTFILE" exists." >&2 - if test -n "$INTERACTIVE"; then - echo -n "[A]bort/[d]elete it/[r]esume? [A/d/r]? " - read -n 1 VAL - echo - if test "$VAL" == "d"; then - rm -i "$OUTFILE"; - elif test "$VAL" == "r"; then - RTMPDUMPOPTS+=" --resume" - else - exit; - fi - else # NON-INTERACTIVE - echo "Error: file exists. bailing out." - exit - fi -fi - -if test -n "$INTERACTIVE"; then - echo "rtmpdump command-line:" - echo " #$RTMPDUMP $RTMPDUMPOPTS -o \"$OUTFILE\" --playpath \"$PLAYPATH\" -r $RTMPURL" - echo - - echo -n " Start Download ? [Y/n] " - read -n 1 VAL - echo - if test "$VAL" == "n" -o "$VAL" == "N"; then - exit; - fi -fi - -$RTMPDUMP $RTMPDUMPOPTS -o "$OUTFILE" --playpath "$PLAYPATH" -r $RTMPURL - -if test -z "$QUIET"; then - echo - ls -l "$OUTFILE" -fi diff --git a/temp_cpu b/temp_cpu new file mode 100755 index 0000000..90b2bc9 --- /dev/null +++ b/temp_cpu @@ -0,0 +1,15 @@ +#!/bin/zsh + +MAX_TEMP=$1 + +for i in \ + /sys/devices/pci0000:00/0000:00:18.3/temp1_input \ + /sys/devices/pci0000:00/0000:00:19.3/temp1_input \ + /sys/devices/pci0000:00/0000:00:1a.3/temp1_input \ + /sys/devices/pci0000:00/0000:00:1b.3/temp1_input; do + TEMP=$(cat $i) + if [ $TEMP -gt $MAX_TEMP ]; then + logger "Some CPU temp @$TEMP (/1000)!" + fi +done + diff --git a/temp_hdd b/temp_hdd new file mode 100755 index 0000000..250c34c --- /dev/null +++ b/temp_hdd @@ -0,0 +1,15 @@ +#!/bin/zsh + +. /home/pks/bin/func.zsh +check_root + +MAX_TEMP=$1 + +for i in `ls -1 /dev/disk/by-id/ | grep -v -P "^wwn-|\-part\d$|md-name|md-uuid"`; do + DRIVE="/dev/disk/by-id/$i" + TEMP=$(/usr/sbin/hddtemp -n $DRIVE 2>/dev/null) + if [ "$TEMP" != "" ]; then + if [ $TEMP -gt $MAX_TEMP ]; then logger "$DRIVE temp at $TEMP"; fi + fi +done + diff --git a/try-qlogin b/try-qlogin deleted file mode 100755 index b939117..0000000 --- a/try-qlogin +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -trap 'echo Control-C trap caught; exit 1' 2 - -while true -do - qlogin -l mem_free=$1 -done - diff --git a/try_qlogin b/try_qlogin new file mode 100755 index 0000000..b939117 --- /dev/null +++ b/try_qlogin @@ -0,0 +1,9 @@ +#!/bin/bash + +trap 'echo Control-C trap caught; exit 1' 2 + +while true +do + qlogin -l mem_free=$1 +done + diff --git a/umount-crypt b/umount-crypt deleted file mode 100755 index 54f7cc0..0000000 --- a/umount-crypt +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/zsh - -. /home/pks/bin/func.zsh -check_root - -umount /mnt -cryptsetup luksClose /dev/mapper/remote_backup - diff --git a/umount_crypt b/umount_crypt new file mode 100755 index 0000000..54f7cc0 --- /dev/null +++ b/umount_crypt @@ -0,0 +1,8 @@ +#!/bin/zsh + +. /home/pks/bin/func.zsh +check_root + +umount /mnt +cryptsetup luksClose /dev/mapper/remote_backup + diff --git a/up_pdf b/up_pdf new file mode 100755 index 0000000..d7613d4 --- /dev/null +++ b/up_pdf @@ -0,0 +1,5 @@ +#!/bin/zsh + +mupdf $1 & +echo $! > .mupdf.pid + diff --git a/up_pdflatex b/up_pdflatex new file mode 100755 index 0000000..b9b141b --- /dev/null +++ b/up_pdflatex @@ -0,0 +1,10 @@ +#!/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/updatepdf b/updatepdf deleted file mode 100755 index d7613d4..0000000 --- a/updatepdf +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/zsh - -mupdf $1 & -echo $! > .mupdf.pid - diff --git a/upgrade-gentoo b/upgrade-gentoo deleted file mode 100755 index 8d94da5..0000000 --- a/upgrade-gentoo +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/zsh - -cd /usr -rsync -avv portage/ portage_/ -umount portage -rm portage.squashfs -mv portage_ portage -perl-cleaner --reallyall -python-updater -emaint --check all -emaint --fix all -emerge --sync -emerge -avuDN --with-bdeps y --keep-going world -echo "-------------------------" -read p\?"press enter to continue... " -etc-update -emerge -av --depclean -revdep-rebuild -eclean -d distfiles -localepurge -mksquashfs portage portage.squashfs -comp xz -mount portage - diff --git a/upgrade-kernel b/upgrade-kernel deleted file mode 100755 index 1971a88..0000000 --- a/upgrade-kernel +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -if [ ! -f .config ]; then echo "Call from kernel source dir!"; exit; fi -V=`pwd | ruby -e "puts STDIN.gets.split('/').last.split('-').last"` -make mrproper -cp -v ../config .config -make -sudo make modules_install -sudo cp -v arch/x86/boot/bzImage /boot/kernel -sudo /sbin/lilo -sudo rm /usr/src/linux -sudo ln -s $(pwd) /usr/src/linux -cd /home/pks/src/tp_smapi/ -sudo make install KVER=$V KSRC=/home/pks/var/kernelbuild/linux-$V KBUILD=/home/pks/var/kernelbuild/linux-$V -sudo make clean -sudo chown -R pks:pks * .* /home/pks/src/tp_smapi/ /home/pks/var/kernelbuild/linux-* -echo "=================" -cd /lib/modules/ -pwd -ls -lah - diff --git a/upgrade_gentoo b/upgrade_gentoo new file mode 100755 index 0000000..46bc154 --- /dev/null +++ b/upgrade_gentoo @@ -0,0 +1,23 @@ +#!/bin/zsh + +cd /usr +rsync -avv portage/ portage_/ +umount portage +rm portage.squashfs +mv portage_ portage +#perl-cleaner --reallyall +#python-updater +emaint --check all +emaint --fix all +emerge --sync +emerge -avuDN --with-bdeps y --keep-going world +echo "-------------------------" +read p\?"press enter to continue... " +etc-update +emerge -av --depclean +revdep-rebuild +eclean -d distfiles +localepurge +mksquashfs portage portage.squashfs -comp xz +mount portage + diff --git a/upgrade_kernel b/upgrade_kernel new file mode 100755 index 0000000..1971a88 --- /dev/null +++ b/upgrade_kernel @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ ! -f .config ]; then echo "Call from kernel source dir!"; exit; fi +V=`pwd | ruby -e "puts STDIN.gets.split('/').last.split('-').last"` +make mrproper +cp -v ../config .config +make +sudo make modules_install +sudo cp -v arch/x86/boot/bzImage /boot/kernel +sudo /sbin/lilo +sudo rm /usr/src/linux +sudo ln -s $(pwd) /usr/src/linux +cd /home/pks/src/tp_smapi/ +sudo make install KVER=$V KSRC=/home/pks/var/kernelbuild/linux-$V KBUILD=/home/pks/var/kernelbuild/linux-$V +sudo make clean +sudo chown -R pks:pks * .* /home/pks/src/tp_smapi/ /home/pks/var/kernelbuild/linux-* +echo "=================" +cd /lib/modules/ +pwd +ls -lah + diff --git a/youtube_mp3 b/youtube_mp3 new file mode 100755 index 0000000..107f0f0 --- /dev/null +++ b/youtube_mp3 @@ -0,0 +1,20 @@ +#!/bin/sh + +usage() +{ + echo "$0 " + 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 + diff --git a/yt2mp3 b/yt2mp3 deleted file mode 100755 index 107f0f0..0000000 --- a/yt2mp3 +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -usage() -{ - echo "$0 " - 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 - -- cgit v1.2.3