dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 15f40881baa5518e8420c7625cb51e4e555581d3
parent 841be2a89c33dcc2e6242d411a88681675e7dd76
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 20 May 2019 22:06:49 +0200

Clean out and simplify user scripts

Diffstat:
D.local/bin/anders | 14--------------
D.local/bin/citeparse.sh | 19-------------------
D.local/bin/ddspawn | 26--------------------------
A.local/bin/detect_file_changes | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D.local/bin/detect_file_changes.sh | 99-------------------------------------------------------------------------------
M.local/bin/dmenurecord | 30+++++++++++++++---------------
D.local/bin/gfdl-ssh | 20--------------------
M.local/bin/julia-fast | 2+-
D.local/bin/jupiter-download.sh | 12------------
D.local/bin/jupiter-order-download.sh | 7-------
D.local/bin/kbd_backlight.sh | 38--------------------------------------
D.local/bin/mailcheck.sh | 56--------------------------------------------------------
D.local/bin/mount-usb.sh | 2--
D.local/bin/mpcdd | 6------
D.local/bin/newsboat-sync | 25-------------------------
M.local/bin/scale.sh | 10++++------
D.local/bin/susan | 14--------------
D.local/bin/tmuxdd | 3---
D.local/bin/tor-browser-update.sh | 104-------------------------------------------------------------------------------
D.local/bin/tor-browser.sh | 2--
D.local/bin/umount-usb.sh | 2--
D.local/bin/vifmrun | 15---------------
M.tmux.conf | 5+++--
23 files changed, 122 insertions(+), 488 deletions(-)

diff --git a/.local/bin/anders b/.local/bin/anders @@ -1,14 +0,0 @@ -#!/bin/sh - -# cmd-line args as message -msg="$*" - -# use STDIN if no args are passed -if [ $# -eq 0 ]; then - msg="$(cat)" -fi - -#to="Susan Louise Damsgaard Sonnesen" -to="Anders Damsgaard" - -osascript -e 'tell application "Messages" to send "'"$msg"'" to buddy "'"$to"'"' diff --git a/.local/bin/citeparse.sh b/.local/bin/citeparse.sh @@ -1,19 +0,0 @@ -#!/bin/bash -input=$(cat -) # read stdin as a single line -echo $input -echo - -# Work in progress. -# -# This script should: -# - remove the word after year in the keyword -# - capitalize the keyword -# - put double brackets around the title string to preserve case -# - fix author firstnames to be initial(s) with spacing and dot(s) appended - -output=$(echo $input |\ - sed -e 's/[a-z]*,/,/' |\ # Remove word after year in keyword - ) - - -echo $output diff --git a/.local/bin/ddspawn b/.local/bin/ddspawn @@ -1,26 +0,0 @@ -#!/bin/sh - -# This script simplifies dropdown windows in i3. -# Shows/hides a scratchpad of a given name, if it doesn't exist, creates it. -# Usage: -# argument 1: script to run in dropdown window -# all other args are interpreted as options for your terminal -# My usage: -# ddpawn -# bindsym $mod+u exec --no-startup-id ddspawn tmuxdd -# Will hide/show window running the `tmuxdd` script when I press mod+u in i3 -# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 -# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font) - -[ -z "$1" ] && exit - -if xwininfo -tree -root | grep "(\"$1\" "; -then - echo "Window detected." -else - echo "Window not detected... spawning." - #i3 "exec --no-startup-id st -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" - i3 "exec --no-startup-id st -n $1 -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" - sleep .25 # This sleep is my laziness, will fix later (needed for immediate appearance after spawn). -fi -i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" diff --git a/.local/bin/detect_file_changes b/.local/bin/detect_file_changes @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +# Specify the file name for storing the file checksums +chksumfile=.checksums.txt + +# Choice of tool for generating and verifying checksums +hashgen=sha256sum + +function show_help { + cat <<-END +Usage: ${0##*/} [OPTIONS] [FILE] +Detect changes to files and directory contents using $hashgen checksums. +Unlike Git and similar, this program does not store file version history. + +On the first run, the program stores the directory contents and the file +cryptographic checksums in a '$chksumfile' file in the current directory. During +subsequent runs, the directory contents and files are compared to the these +stored values. + +Options: + -h, --help show this message + - list all files and their checksums to stdout + -a, --add FILE update the stored checksum value of FILE + -r, --reset reset the values $chksumfile to the current state, which is + identical to calling '--add FILE' to all files + +This program exits with return status 0 if no changes are found to the stored +state, and 1 if changes are detected. + +Author: Anders Damsgaard anders@adamsgaard.dk, License: GPLv3+ +END +} + +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + show_help + exit 0 +fi + +# Return checksums for all files in all subdirectories +function generate_checksums { + find . -type f `# search files in all subdirectories` \ + ! -name "$chksumfile" `# ignore the checksumfile itself` \ + ! -name "${0##*/}" `# ignore this file` \ + ! -name ".*.swp" `# ignore editor swap files` \ + -exec "$hashgen" '{}' + `# run hash command on every found file` +} + +function check_if_file_exists { + if [ ! -f "$1" ]; then + (<&2 echo "Error: file '$1' was not found") + exit 2 + fi +} + +function update_checksum { + file=${1//\//\\\/} # escape forward slashes + file=${file//\./\\.} # escape periods + file=${file// /\\ } # escape spaces + # sed -i '' "s/^.* \*\.$file/$($hashgen $1) *.\/$file/" "$2" + grep "$file" "$2" + sed -i '' "s/.*\ $file/asdf/" "$2" + +} + +if [ ! -f "$chksumfile" ] || [ "$1" = "-r" ] || [ "$1" = "--reset" ]; then + # (Over-)write checksum file + generate_checksums > "$chksumfile" + echo "Checksums stored in $chksumfile" + +elif [ "$1" = "-a" ] || [ "$1" = "--add" ]; then + for file in "${@:2}"; do + check_if_file_exists "$file" + done + # Update checksums for all specified files + for file in "${@:2}"; do + update_checksum "$file" "$chksumfile" + done + +elif [ "$1" = "-" ]; then + # Print checksums and file paths to stdout + generate_checksums + +else + # Compare current checksums against stored values + generate_checksums \ + | diff "$chksumfile" - `# compare stored checksums with current vals` \ + | sed 's/>/new: /' `# replace > with new:` \ + | sed 's/</rem: /' `# replace < with rem:` \ + | sed 's/\*\.\///' `# simplify file path` + #| awk '{ print $1 $3 }' `# hide checksum in second column` \ + + # Report if the diff command returned with status 0 + if [ ${PIPESTATUS[1]} -eq 0 ]; then + echo "No file changes detected" + else + # Return exit status 1 if something changed + exit 1 + fi +fi diff --git a/.local/bin/detect_file_changes.sh b/.local/bin/detect_file_changes.sh @@ -1,99 +0,0 @@ -#!/usr/bin/env bash - -# Specify the file name for storing the file checksums -chksumfile=.checksums.txt - -# Choice of tool for generating and verifying checksums -hashgen=sha256sum - -function show_help { - cat <<-END -Usage: ${0##*/} [OPTIONS] [FILE] -Detect changes to files and directory contents using $hashgen checksums. -Unlike Git and similar, this program does not store file version history. - -On the first run, the program stores the directory contents and the file -cryptographic checksums in a '$chksumfile' file in the current directory. During -subsequent runs, the directory contents and files are compared to the these -stored values. - -Options: - -h, --help show this message - - list all files and their checksums to stdout - -a, --add FILE update the stored checksum value of FILE - -r, --reset reset the values $chksumfile to the current state, which is - identical to calling '--add FILE' to all files - -This program exits with return status 0 if no changes are found to the stored -state, and 1 if changes are detected. - -Author: Anders Damsgaard anders@adamsgaard.dk, License: GPLv3+ -END -} - -if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - show_help - exit 0 -fi - -# Return checksums for all files in all subdirectories -function generate_checksums { - find . -type f `# search files in all subdirectories` \ - ! -name "$chksumfile" `# ignore the checksumfile itself` \ - ! -name "${0##*/}" `# ignore this file` \ - ! -name ".*.swp" `# ignore editor swap files` \ - -exec "$hashgen" '{}' + `# run hash command on every found file` -} - -function check_if_file_exists { - if [ ! -f "$1" ]; then - (<&2 echo "Error: file '$1' was not found") - exit 2 - fi -} - -function update_checksum { - file=${1//\//\\\/} # escape forward slashes - file=${file//\./\\.} # escape periods - file=${file// /\\ } # escape spaces - # sed -i '' "s/^.* \*\.$file/$($hashgen $1) *.\/$file/" "$2" - grep "$file" $2 - sed -i '' "s/.*\ $file/asdf/" "$2" - -} - -if [ ! -f "$chksumfile" ] || [ "$1" = "-r" ] || [ "$1" = "--reset" ]; then - # (Over-)write checksum file - generate_checksums > "$chksumfile" - echo "Checksums stored in $chksumfile" - -elif [ "$1" = "-a" ] || [ "$1" = "--add" ]; then - for file in "${@:2}"; do - check_if_file_exists "$file" - done - # Update checksums for all specified files - for file in "${@:2}"; do - update_checksum "$file" "$chksumfile" - done - -elif [ "$1" = "-" ]; then - # Print checksums and file paths to stdout - generate_checksums - -else - # Compare current checksums against stored values - generate_checksums \ - | diff "$chksumfile" - `# compare stored checksums with current vals` \ - | sed 's/>/new: /' `# replace > with new:` \ - | sed 's/</rem: /' `# replace < with rem:` \ - | sed 's/\*\.\///' `# simplify file path` - #| awk '{ print $1 $3 }' `# hide checksum in second column` \ - - # Report if the diff command returned with status 0 - if [ ${PIPESTATUS[1]} -eq 0 ]; then - echo "No file changes detected" - else - # Return exit status 1 if something changed - exit 1 - fi -fi diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord @@ -10,15 +10,15 @@ # If there is already a running instance, user will be prompted to end it. updateicon() { \ - echo "$1" > ~/.recordingicon + echo "$1" > /tmp/recordingicon pkill -RTMIN+9 i3blocks } killrecording() { - recpid="$(cat ~/.recordingpid)" + recpid="$(cat /tmp/recordingpid)" # kill with SIGTERM, allowing finishing touches. kill -15 "$recpid" - rm -f ~/.recordingpid + rm -f /tmp/recordingpid updateicon "" pkill -RTMIN+9 i3blocks # even after SIGTERM, ffmpeg may still run, so SIGKILL it. @@ -31,41 +31,41 @@ screencast() { \ ffmpeg -y \ -f x11grab \ -framerate 60 \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ -i :0.0 \ -f alsa -i default \ -r 30 \ -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > ~/.recordingpid + echo $! > /tmp/recordingpid updateicon "⏺️🎙️" } video() { ffmpeg \ -f x11grab \ - -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ -i :0.0 \ -c:v libx264 -qp 0 -r 30 \ "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > ~/.recordingpid + echo $! > /tmp/recordingpid updateicon "⏺️" } webcamhidef() { ffmpeg \ - -f v412 \ + -f v4l2 \ -i /dev/video0 \ -video_size 1920x1080 \ "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > ~/.recordingpid + echo $! > /tmp/recordingpid updateicon "🎥" } webcam() { ffmpeg \ - -f v412 \ + -f v4l2 \ -i /dev/video0 \ -video_size 640x480 \ "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! > ~/.recordingpid + echo $! > /tmp/recordingpid updateicon "🎥" } @@ -75,7 +75,7 @@ audio() { \ -f alsa -i default \ -c:a flac \ "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & - echo $! > ~/.recordingpid + echo $! > /tmp/recordingpid updateicon "🎙️" } @@ -85,8 +85,8 @@ askrecording() { \ screencast) screencast;; audio) audio;; video) video;; - webcam) webcamrecord;; - "webcam (hi-def)") webcamrecord;; + webcam) webcam;; + "webcam (hi-def)") webcamhidef;; esac } @@ -101,5 +101,5 @@ case "$1" in audio) audio;; video) video;; kill) killrecording;; - *) ([ -f ~/.recordingpid ] && asktoend && exit) || askrecording;; + *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; esac diff --git a/.local/bin/gfdl-ssh b/.local/bin/gfdl-ssh @@ -1,20 +0,0 @@ -#!/bin/bash -# for tput commands: see `man 5 terminfo` -tmux rename-window gfdl -echo "$(tput setaf 1)## Make sure to connect to Princeton VPN (Connect\ Tunnel.app) first ##$(tput sgr0)" - -pass -c Uni/noaa-rsa-pin - -workstation=ldt-1467463 # GFDL workstation hostname -port=26075 # `echo "$(id -u) + 5900" | bc` on gfdl workstation - -if [ "$1" = "vnc" ]; then - - echo "$(tput setaf 3)Establishing SSH tunnel to GFDL gateway$(tput sgr0)" - ssh -X -L5905:${workstation}:${port} Anders.Damsgaard@ssh-rsa.gfdl.noaa.gov - ssh $workstation - -else - echo "$(tput setaf 2)# Paste passphrase from clipboard (Cmd-v) + 6 RSA fob digits$(tput sgr0)" - ssh -Y Anders.Damsgaard@ssh-rsa.gfdl.noaa.gov -fi diff --git a/.local/bin/julia-fast b/.local/bin/julia-fast @@ -1,2 +1,2 @@ #!/bin/sh -julia --procs 1 --optimize=3 --math-mode=fast $@ +julia --procs 1 --optimize=3 --math-mode=fast "$@" diff --git a/.local/bin/jupiter-download.sh b/.local/bin/jupiter-download.sh @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e - -url="http://gerda.geus.dk/Gerda/exportfiles/?filename=pcjupiterxlpluspg_xl.zip" -date="$(date +%Y%m%d)" -basename="pcjupiterxlpluspg_xl" -ziptarget="${basename}_${date}.zip" - -curl "$url" -o "$ziptarget" -unzip "$ziptarget" -d . - -mv pcjupiterxlpluspg_xl{,"_${date}"}.backup diff --git a/.local/bin/jupiter-order-download.sh b/.local/bin/jupiter-order-download.sh @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e -url="http://gerda.geus.dk/Gerda/PCJupiterXL/export?email=andam@mst.dk&filetype=POSTGRES&geusdbtype=PCJupiterXL&sqlwhere=(1=1)&dbfilename=PCJUPITERXLPLUS_full_$(date +%Y%m%d)&datum=euref89&utmzone=32&kote=dvr90&isPlusVersion=true" - -echo "$url" -echo -curl "$url" diff --git a/.local/bin/kbd_backlight.sh b/.local/bin/kbd_backlight.sh @@ -1,38 +0,0 @@ -#!/bin/bash - -# Define the increment between adjustments -#INC=5 - -# Define the brightness increment factor between adjustments -INC=3 - -# The folder containing keyboard backlight files -CTRLDIR=/sys/class/leds/smc::kbd_backlight - -# The current brightness file -CTRLF=$CTRLDIR/brightness - -# The current brightness value -V=`cat $CTRLF` - -# The max. brightness value -MAXV=`cat $CTRLDIR/max_brightness` -MINV=0 - -if [[ "$1" == "up" ]]; then - #NEWV=$((V+INC)) - NEWV=$(((2+V)*INC)) - if (( "$NEWV" <= "$MAXV" )); then - echo $NEWV > $CTRLF - else - echo $MAXV > $CTRLF - fi -elif [[ "$1" == "down" ]]; then - #NEWV=$((V-INC)) - NEWV=$((V/INC-2)) - if (( "$NEWV" >= "$MINV" )); then - echo $NEWV > $CTRLF - else - echo $MINV > $CTRLF - fi -fi diff --git a/.local/bin/mailcheck.sh b/.local/bin/mailcheck.sh @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# add to crontab with: -# */3 * * * * ~/bin/mailcheck.sh - -# Check every ten seconds if the process identified as $1 is still running. -# After 5 checks (~60 seconds), kill it. Return non-zero to -# indicate something was killed. -monitor() { - local pid=$1 i=0 - - while ps $pid &>/dev/null; do - if (( i++ > 5 )); then - echo "Max checks reached. Sending SIGKILL to - ${pid}..." >&2 - kill -9 $pid; return 1 - fi - - sleep 10 - done - - return 0 -} - -read -r pid < ~/.offlineimap/pid - -if ps $pid &>/dev/null; then - echo "Process $pid already - running. Exiting..." >&2 - exit 1 -fi - -# count new mail for every maildir -maildirnew="$HOME/mail/*/INBOX/new/" -new="$(find $maildirnew -type f | wc -l | sed 's/ //g')" -mailboxes="$(find $maildirnew -type f | sed 's/.*mail\///' | sed 's/\/INBOX.*//')" -if [ $new -gt 0 ]; then - - UNAMESTR=`uname` - announcement="New mail: $new\nIn $mailboxes" - if [[ "$UNAMESTR" == 'Darwin' ]]; then - osascript -e "display notification \"$announcement\" with title \"offlineimap\"" - - # Linux - elif [[ "$UNAMESTR" == 'Linux' ]]; then - export DISPLAY=:0; export XAUTHORITY=~/.Xauthority - notify-send "$announcement" - fi -fi - - - -#/usr/local/bin/offlineimap -o -u quiet & monitor $! - -# sync INBOXes only -/usr/local/bin/offlineimap -qf INBOX -o -u quiet & monitor $! diff --git a/.local/bin/mount-usb.sh b/.local/bin/mount-usb.sh @@ -1,2 +0,0 @@ -#!/bin/sh -sudo mount /dev/sdb1 /media/usb && echo 'mounted in /media/usb. Umount with umount-usb.sh' diff --git a/.local/bin/mpcdd b/.local/bin/mpcdd @@ -1,6 +0,0 @@ -#!/bin/sh -SESSION=mpc -(tmux attach -t "$SESSION" \; \ - split-window -p 50 "source ~/code/fzf-mpd/fzf-mpd.zsh && fm") \ - || \ - (tmux new-session -s "$SESSION" \; send-keys "ncmpcpp; exit" C-m) diff --git a/.local/bin/newsboat-sync b/.local/bin/newsboat-sync @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -set -e - -function info { - echo -en "$(tput setaf 2)$*$(tput sgr0)" -} - -eval "$(gpg-agent)" -GPG_TTY=$(tty) -export GPG_TTY -eval "$(ssh-agent)" -# Add ssh key if not already added -if [ "$(uname)" = "Darwin" ]; then - ssh-add -l | grep -q '\.ssh/id_rsa' || ssh-add -K -else - ssh-add -l | grep -q '\.ssh/id_rsa' || ssh-add -fi - -# info "Downloading newest cache..." -# rsync -aq -e 'ssh -q' andersdc@adamsgaard.dk:~/.newsboat/cache.db ~/.newsboat/cache.db -# info "done.\\n" -newsboat -# info "Uploading local cache..." -# rsync -aq -e 'ssh -q' ~/.newsboat/cache.db andersdc@adamsgaard.dk:~/.newsboat/cache.db -# info "done.\\n" diff --git a/.local/bin/scale.sh b/.local/bin/scale.sh @@ -1,13 +1,11 @@ -#!/bin/bash -if [[ "$1" == "-h" || "$1" == "--help" ]]; then +#!/bin/sh +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Scale image sizes using Imagemagick's convert command." echo "Usage: $0 <PERCENTAGE>% <FILE[S]>" exit 0 fi for f in "$@"; do - if [[ "$f" != *% ]]; then - echo "$f" - convert "$f" -resize "$1" "scaled-$f" - fi + echo "$f" + convert "$f" -resize "$1" "scaled-$f" done diff --git a/.local/bin/susan b/.local/bin/susan @@ -1,14 +0,0 @@ -#!/bin/bash - -# cmd-line args as message -msg="$@" - -# use STDIN if no args are passed -if [ $# -eq 0 ]; then - msg="$(cat)" -fi - -to="Susan Louise Damsgaard Sonnesen" -#to="Anders Damsgaard" - -osascript -e 'tell application "Messages" to send "'"$msg"'" to buddy "'"$to"'"' diff --git a/.local/bin/tmuxdd b/.local/bin/tmuxdd @@ -1,3 +0,0 @@ -#!/bin/sh -SESSION=dropdown -tmux attach -t "$SESSION" || tmux new-session -s "$SESSION" diff --git a/.local/bin/tor-browser-update.sh b/.local/bin/tor-browser-update.sh @@ -1,104 +0,0 @@ -#!/bin/bash - -# stop on error -set -e - -# Gets latest Tor Browser Bundle (TBB) stable version for Linux x86_64, -# downloads it, verifies it, and extracts it. -# The scripts downloads the files using "torsocks", if available. - -# Folder where to download and extract the archives -TORFOLDER=~/tor - -# Remote folder containing the TBB archives -UNAMESTR=$(uname) -if [[ "$UNAMESTR" == 'Linux' ]]; then - DIR="https://www.torproject.org/dist/torbrowser" - - if [ -e /etc/apt/sources.list ] && \ - ! dpkg -l deb.torproject.org-keyring; then - - # Import the signing key to Debian - gpg2 --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 - gpg2 --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | \ - sudo apt-key add - - - sudo apt-get update - sudo apt-get install deb.torproject.org-keyring - fi - -# elif [[ "$UNAMESTR" == 'Darwin' ]]; then -# DIR="https://www.torproject.org/dist/torbrowser" -else - echo "Platform not supported" - exit 1 -fi - -# Check if torsocks is installed -GETCMD="wget --no-verbose" -if command -v torsocks 2>/dev/null; then - TORIFY="yes" - DOWNLOADCMD="torsocks $GETCMD" -else - DOWNLOADCMD=$GETCMD -fi - -# Find latest TBB version -echo "Determining latest Tor Browser Bundle stable version" -TMPFILENAME=/tmp/tordownloadpage.html -$DOWNLOADCMD https://www.torproject.org/projects/torbrowser.html.en#downloads \ - -O $TMPFILENAME && \ -LATESTTBB=$(grep '_en-US.tar.xz">64-bit' $TMPFILENAME | \ - head -n 1 | \ - sed 's/.*tor-browser/tor-browser/' | \ - sed 's/tar.xz.*/tar.xz/') && \ -echo "Latest Tor Browser Bundle stable version is $LATESTTBB" -LATESTVERSION="$(echo "$LATESTTBB" | \ - sed 's/.*-linux64-//' | \ - sed 's/_en-US.*//')" -echo "Latest version string: $LATESTVERSION" - -#rm $TMPFILENAME - -# Check if the TBB version is already downloaded -if [ -e "$TORFOLDER/$LATESTTBB" ]; then - echo "The installed TBB version is up to date." - exit -fi - -# Download compressed file and signature, and verify -mkdir -p $TORFOLDER -cd $TORFOLDER &&\ -echo "Attempting to download Tor Browser Bundle and signature" -TARGET="${DIR}/${LATESTVERSION}/$LATESTTBB.asc" -echo "$TARGET" -$DOWNLOADCMD "$TARGET" &&\ -if [[ -z "$TORIFY" ]]; then - $GETCMD "$TARGET" -O "$TARGET".notor -fi -TARGET="${DIR}/${LATESTVERSION}/$LATESTTBB" -echo "$TARGET" -$DOWNLOADCMD "$TARGET" &&\ -gpg --verify "$LATESTTBB"{.asc,} &&\ -if [[ -z "$TORIFY" ]]; then - gpg --verify "$LATESTTBB"{.asc.notor,} -fi - -# Save the Tor data directory, if it exists -BACKUPDATA=0 -DATAFOLDER=$TORFOLDER/tor-browser_en-US/Data/Tor -if [ -e $DATAFOLDER ]; then - rm -r $TORFOLDER/Tor - cp -r $DATAFOLDER $TORFOLDER - BACKUPDATA=1 -fi - -# Unpack the TBB -tar -xJf "$LATESTTBB" &&\ -echo "Installation complete. Start with tor-browser.sh" - -# Copy the old Data folder to the new TBB -if [ $BACKUPDATA == 1 ]; then - cp $TORFOLDER/Tor/* $DATAFOLDER -fi -cd - diff --git a/.local/bin/tor-browser.sh b/.local/bin/tor-browser.sh @@ -1,2 +0,0 @@ -#!/bin/sh -cd ~/tor/tor-browser_en-US && ./start-tor-browser.desktop diff --git a/.local/bin/umount-usb.sh b/.local/bin/umount-usb.sh @@ -1,2 +0,0 @@ -#!/bin/sh -sudo umount /media/usb && echo "/media/usb unmounted" diff --git a/.local/bin/vifmrun b/.local/bin/vifmrun @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" - -function cleanup { - rm "$FIFO_UEBERZUG" 2>/dev/null - pkill -P $$ 2>/dev/null -} - -rm "$FIFO_UEBERZUG" 2>/dev/null -mkfifo "$FIFO_UEBERZUG" -trap cleanup EXIT -tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & - -vifm -cleanup diff --git a/.tmux.conf b/.tmux.conf @@ -49,9 +49,10 @@ bind t set status on bind T set status off # Right section of status bar -if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//') #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%F #[fg=#bababa]%R\"" +if-shell 'uname | grep -qi Darwin' "set -g status-right +\"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//') #[fg=cyan]#(~/bin/battery-osx) #(~/.local/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%F #[fg=#bababa]%R\"" -if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(~/bin/battery-linux) #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\"" +if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(~/bin/battery-linux) #(~/bin/.local/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\"" # Scaling of status-bar sections set -g status-right-length 40