From a9ba01279e6f3c64b082f4de6e7d95cd1b5f7dab Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 11 May 2013 13:03:54 +0200 Subject: lots of new stuff and misc changes Signed-off-by: Florian Pritz --- filter-gcode | 6 ++++++ firefox-youtube-handler | 9 +++++++++ git-blamestat | 1 + openbox-shutdown.conf | 6 +++--- remotes/falconindy-bin | 2 +- replace.py | 17 +++++++++++++++++ screen-locker.sh | 2 +- set-background.sh | 5 +++-- slic3r | 7 +++++++ start-rsyncd.sh | 34 ++++++++++++++++++++++++++++++++++ vpn-connect | 10 ++++++++++ 11 files changed, 92 insertions(+), 7 deletions(-) create mode 100755 filter-gcode create mode 100755 firefox-youtube-handler create mode 120000 git-blamestat create mode 100755 replace.py create mode 100755 slic3r create mode 100755 start-rsyncd.sh create mode 100755 vpn-connect diff --git a/filter-gcode b/filter-gcode new file mode 100755 index 0000000..e6c4293 --- /dev/null +++ b/filter-gcode @@ -0,0 +1,6 @@ +#!/bin/bash + +sed -i "$1" \ + -e '/^M190 S90 ;.*$/d' \ + -e '/^M104 S220 ;.*$/d' \ + -e '/^M109 S220 ;.*$/d' \ diff --git a/firefox-youtube-handler b/firefox-youtube-handler new file mode 100755 index 0000000..b339612 --- /dev/null +++ b/firefox-youtube-handler @@ -0,0 +1,9 @@ +#!/bin/bash +proto='yt://' +url=$1 +id=${url##$proto} +#smplayer $(youtube-dl -g ${id}) + +#urxvt -e bash -c "youtube-viewer -I \"http://youtube.com/watch?v=$id\"; sleep 5" +smplayer "http://youtube.com/watch?v=$id" + diff --git a/git-blamestat b/git-blamestat new file mode 120000 index 0000000..d20839c --- /dev/null +++ b/git-blamestat @@ -0,0 +1 @@ +remotes/falconindy-bin/git-blamestat \ No newline at end of file diff --git a/openbox-shutdown.conf b/openbox-shutdown.conf index eb4350c..bf9e64a 100644 --- a/openbox-shutdown.conf +++ b/openbox-shutdown.conf @@ -18,7 +18,7 @@ [reboot] #command = openbox --exit -command = sudo shutdown -r now +command = systemctl reboot image = /usr/share/icons/hydroxygen/72x72/apps/gnome-session-reboot.png info_text = Reboot #label = _Neu starten @@ -26,7 +26,7 @@ label = None [shutdown] #command = openbox --exit -command = sudo shutdown -h now +command = systemctl poweroff image = /usr/share/icons/hydroxygen/72x72/apps/gnome-session-halt.png info_text = Halt #label = _Herunterfahren @@ -34,7 +34,7 @@ label = None [suspend] command = screen-locker.sh -command = sudo pm-suspend +command = systemctl suspend image = /usr/share/icons/hydroxygen/72x72/apps/gnome-session-suspend.png info_text = Suspend2Ram #label = _Suspend diff --git a/remotes/falconindy-bin b/remotes/falconindy-bin index 5bf3d6d..242df7b 160000 --- a/remotes/falconindy-bin +++ b/remotes/falconindy-bin @@ -1 +1 @@ -Subproject commit 5bf3d6db10f439690b23e6ac67a3474dbea747b6 +Subproject commit 242df7b3f1171087e1e74b4e08bd51f1ddcda61c diff --git a/replace.py b/replace.py new file mode 100755 index 0000000..efa8b54 --- /dev/null +++ b/replace.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import sys + +string_from = sys.argv[1] +string_to = sys.argv[2] +files = sys.argv[3:] + +for filename in files: + f = open(filename, "r+") + data = f.read() + data = data.replace(string_from, string_to) + f.seek(0) + f.truncate() + f.write(data) + f.close() + diff --git a/screen-locker.sh b/screen-locker.sh index efb3dbb..a27557f 100755 --- a/screen-locker.sh +++ b/screen-locker.sh @@ -24,6 +24,6 @@ unlock () { } #if pidof i3lock &> /dev/null; then exit 1; fi -if pidof slock &> /dev/null; then exit 1; fi +if pgrep slock &> /dev/null; then exit 1; fi (lock && unlock) & diff --git a/set-background.sh b/set-background.sh index 8d72476..ea48e05 100755 --- a/set-background.sh +++ b/set-background.sh @@ -26,10 +26,11 @@ cd "$(dirname "$1")" FILE="$(pwd)/$(basename "$1")" if [ -f "$FILE" ]; then - echo "feh --bg-tile '${FILE}'" > "$HOME/.fehbg"; + #echo "feh --bg-tile '${FILE}'" > "$HOME/.fehbg"; + echo "habak -mS '${FILE}'" > "$HOME/.bg"; #rm "$HOME/backgrounds/current_bg"; #ln -sf "${FILE}" "$HOME/backgrounds/current_bg"; - source $HOME/.fehbg + source $HOME/.bg else notify-send -t 10000 "Background" "Error: File \"${FILE}\" doesn't exist"; exit 1 diff --git a/slic3r b/slic3r new file mode 100755 index 0000000..f3e1753 --- /dev/null +++ b/slic3r @@ -0,0 +1,7 @@ +#!/bin/bash + +for config in "$HOME"/.Slic3r/*/config.ini; do + opts+=(--load "$config") +done + +perl "$HOME"/git/Slic3r/slic3r.pl "${opts[@]}" "$@" diff --git a/start-rsyncd.sh b/start-rsyncd.sh new file mode 100755 index 0000000..3fa22ee --- /dev/null +++ b/start-rsyncd.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +while :; do + port=$RANDOM + [[ $port -gt 1024 && $port -lt 65535 ]] && break +done + +tmpdir=$(mktemp -d /tmp/start-rsyncd.sh.XXXXXX) + +cleanup() { + rm -rf "$tmpdir" +} + +trap cleanup EXIT INT TERM + +cat <"$tmpdir/rsyncd.conf" +max connections = 1 +pid file = $tmpdir/pid +lock file = $tmpdir/lock +use chroot = no +log file = /dev/stderr +read only = true +port = $port +uid = $USER +[share] + path = $PWD +EOF + +echo "use: rsync -rtP --port $port \"rsync://$(hostname -f)/share/\" \"share-copy/\"" +echo "stating rsyncd..." +rsync --daemon --no-detach --config="$tmpdir/rsyncd.conf" + diff --git a/vpn-connect b/vpn-connect new file mode 100755 index 0000000..692310e --- /dev/null +++ b/vpn-connect @@ -0,0 +1,10 @@ +#!/bin/bash + +vpnc tu.conf + +ip route delete default dev vpntun0 +ip route add default via 192.168.4.1 dev eth0 + +for i in 128.130.0.0/15 192.35.240.0/24 193.170.3.0/24 193.170.72.0/21; do + ip route add $i dev vpntun0 +done -- cgit v1.2.3-24-g4f1b