diff --git a/bin/backup.sh b/bin/backup.sh new file mode 100755 index 0000000..bb6eb33 --- /dev/null +++ b/bin/backup.sh @@ -0,0 +1,46 @@ +#!/bin/sh +BACKUP_MACHINE="frumar.yori.cc" +DATE_FORMAT="+%Y-%m-%d" +BACKUP_DIR="/data/yorick/backup" + +function is_locked() { + # check for lockfile + if [[ -f /tmp/rbs.lock ]]; then + # process already running? + if [[ "$(ps -p $(cat /tmp/rbs.lock) | wc -l)" -gt 1 ]]; then +echo "locked" + return +fi +fi +echo "unlocked" +} + +if [[ $(is_locked) == "locked" ]]; then +echo "process already running, aborting..." + exit 1 +fi + +# create lockfile +rm -f /tmp/rbs.lock +echo $$ > /tmp/rbs.lock + +echo "update local bup index..." +cd $HOME # do it here so that the bupignore paths work without rewriting +ionice -c3 bup index -u $HOME --xdev --exclude-from $HOME/dotfiles/misc/bupignore + +# check if backup machine is available +#ping -w 5 -c 1 $BACKUP_MACHINE +#if [ $? -eq 0 ]; then + # start backup + + echo "copy bup packs..." + branch="$(hostname)-$(date $DATE_FORMAT)" + ionice -c3 bup save -n $branch $HOME -r $BACKUP_MACHINE:$BACKUP_DIR/home/ + + #echo "verify bup packs..." + #cd $BACKUP_DIR/home + #ionice -c3 bup -d . fsck -g -vv +#fi + +# remove lockfile +rm -f /tmp/rbs.lock diff --git a/bin/byzanz-window b/bin/byzanz-window new file mode 100755 index 0000000..5af4b41 --- /dev/null +++ b/bin/byzanz-window @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# Delay before starting +DELAY=5 + +# Sound notification to let one know when recording is about to start (and ends) +beep() { + paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg & +} + +# Duration and output file +if [ $# -gt 0 ]; then + D="--duration=$@" +else + echo Default recording duration 10s to /tmp/recorded.gif + D="--duration=10 /tmp/recorded.gif" +fi +XWININFO=$(xwininfo) +read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO") +read Y < <(awk -F: '/Absolute upper-left Y/{print $2}' <<< "$XWININFO") +read W < <(awk -F: '/Width/{print $2}' <<< "$XWININFO") +read H < <(awk -F: '/Height/{print $2}' <<< "$XWININFO") + +echo Delaying $DELAY seconds. After that, byzanz will start +for (( i=$DELAY; i>0; --i )) ; do + echo $i + sleep 1 +done + +beep +byzanz-record -c --verbose --delay=0 --x=$X --y=$Y --width=$W --height=$H $D +beep + diff --git a/bin/docked.sh b/bin/docked.sh index c451f49..561abdf 100755 --- a/bin/docked.sh +++ b/bin/docked.sh @@ -1,16 +1,16 @@ -#!/usr/bin/sh +#!/bin/sh # this script checks if the system is docked with the lid closed # and if so, sets the correct DPI, disables the laptop screen, sets the DP-3 monitor as primary # and loads the nvidia config for vsync options and sets the dithering depth to 8 -if [ `cat /sys/devices/platform/hp-wmi/dock` -eq 1 ] && [[ `cat /proc/acpi/button/lid/LID/state` == *closed* ]] +if [ `cat /sys/devices/platform/hp-wmi/dock` -eq 1 ] # && [[ `cat /proc/acpi/button/lid/LID/state` == *closed* ]] then echo "Using docked configuration with 27\" IPS screen and VGA-screen" - xrandr --output LVDS-0 --off --output DP-3 --primary --output VGA-0 --left-of DP-3 --dpi 108.79/DP-3 - nvidia-settings -l -a "0/XVideoSyncToDisplay=1048576" - echo "Xft.dpi: 108.79" | xrdb -merge + xrandr --output DP-3 --primary --preferred --output LVDS-0 --left-of DP-3 --dpi 109/DP-3 + nvidia-settings -a "0/XVideoSyncToDisplayID=DP-3" + echo "Xft.dpi: 109" | xrdb -merge else echo "Using laptop-only configuration" - xrandr --output LVDS-0 --mode 1920x1080 --primary --rotate normal --pos 0x0 --output VGA-0 --off --output DP-3 --off --dpi 146.86/LVDS-0 - nvidia-settings -l - echo "Xft.dpi: 146.86" | xrdb -merge + xrandr --output LVDS-0 --mode 1920x1080 --primary --rotate normal --pos 0x0 --output VGA-0 --off --output DP-3 --off --dpi 146/LVDS-0 + nvidia-settings -l -a "0/XVideoSyncToDisplayID=LVDS-0" + echo "Xft.dpi: 146" | xrdb -merge fi diff --git a/bin/fsize.sh b/bin/fsize.sh new file mode 100755 index 0000000..82bd210 --- /dev/null +++ b/bin/fsize.sh @@ -0,0 +1,3 @@ +#!/bin/sh +printf '\33]50;%s%d%s\007' "xft:SourceCodePro:pixelsize=" $1 ":antialias=true:hinting=true" + diff --git a/bin/mute_toggle.sh b/bin/mute_toggle.sh deleted file mode 100755 index 9b7a36e..0000000 --- a/bin/mute_toggle.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Credit to Roland Latour -# http://www.freak-search.com/en/thread/4707111/q_volume_control,_xfce - -# Find default sink - -mute_cmd=$(amixer set Master toggle | egrep 'Playback.*?\[o' | head -n 1) -mute=$(echo "$mute_cmd" | egrep -o '\[o.+\]') -volume=$(echo "$mute_cmd" | sed '{s/://}' | awk '{print $4}') -let volume=($volume * 100 / 65536) -if [[ "$mute" == "[on]" ]]; then - # show the volume - volnoti-show $volume -fi -[[ "$mute" == "[off]" ]] && volnoti-show -m diff --git a/bin/periodic_screenshot.sh b/bin/periodic_screenshot.sh new file mode 100755 index 0000000..6d42480 --- /dev/null +++ b/bin/periodic_screenshot.sh @@ -0,0 +1,11 @@ +#!/bin/zsh + +format="%Y-%m-%d_%H-%M_$(hostname).png" +exec="mv \$f $HOME/periodic_screenshot/" + +if [[ $(pidof X) -gt 0 ]]; then + DISPLAY=:0.0 xset -b + DISPLAY=:0.0 scrot -m $format -q 10 -e "$exec" + DISPLAY=:0.0 xset b +fi + diff --git a/bin/screenshot_dropbox.sh b/bin/screenshot_dropbox.sh deleted file mode 100755 index edbca2d..0000000 --- a/bin/screenshot_dropbox.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Setup filename for the screenshot -myfile=$(date +%Y%m%d%H%M%S).png - -#Setup paths to dropbox & full url to new screenshot -dropboxwebpath='http://dl.dropbox.com/u/22989236/temp/' # PUT YOUR DROPBOX USERID HERE -dropboxfileurl=$dropboxwebpath$myfile - -# see: http://code.google.com/p/xmonad/issues/detail?id=476 -sleep 0.2 - -# Use scrot to take a screenshot and stick it in your dropbox screenshots folder -scrot $myfile -e 'mv $f ~/Dropbox/Public/temp/' -s - -# Put full URL to new screenshot into clipboard -echo $dropboxfileurl | xclip -selection c diff --git a/bin/screenshot_public.sh b/bin/screenshot_public.sh new file mode 100755 index 0000000..01c3e1a --- /dev/null +++ b/bin/screenshot_public.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Setup filename for the screenshot +myfile=$(date +%Y%m%d%H%M%S).png + +webpath='https://pub.yori.cc/screen/' +fileurl=$webpath$myfile + +# see: http://code.google.com/p/xmonad/issues/detail?id=476 +sleep 0.2 + +scrot $myfile -e 'mv $f ~/public/screen/' -s + +# copy-paste +echo $fileurl | xclip -selection c +cd ~ +rsync -LavP --cvs-exclude public pub.yori.cc: diff --git a/bin/vga_setup.sh b/bin/vga_setup.sh new file mode 100755 index 0000000..4a69f94 --- /dev/null +++ b/bin/vga_setup.sh @@ -0,0 +1,3 @@ +xrandr --output VGA-0 --preferred --left-of LVDS-0 --output LVDS-0 --primary +feh --bg-fill ~/dotfiles/awesome/wallpaper.png +echo "power on" | sudo bluetoothctl diff --git a/bin/vol_down.sh b/bin/vol_down.sh deleted file mode 100755 index fc7e7e8..0000000 --- a/bin/vol_down.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# lower volume by 1% -volume=$(amixer set Master playback 1%- | grep "t: Playback" | sed '{s/://}' | awk '{print $5}' | head -n 1 | cut -c2- | rev | cut -c3- | rev) -volnoti-show $volume diff --git a/bin/vol_up.sh b/bin/vol_up.sh deleted file mode 100755 index b08893f..0000000 --- a/bin/vol_up.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Raise volume by 1% - -volume=$(amixer set Master playback 1%+ | grep "t: Playback" | sed '{s/://}' | awk '{print $5}' | head -n 1 | cut -c2- | rev | cut -c3- | rev) -volnoti-show $volume