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 6d31bfdf97c470cb36006170a69b6d8cf57fb43f
parent d0a8ba924bd054f577012cc7bd245a8ed75bacdd
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 19 Feb 2020 09:29:06 +0100

Remove unused scripts, remove bash deps

Diffstat:
D.local/bin/contactmenu | 14--------------
D.local/bin/irg | 22----------------------
D.local/bin/message | 94-------------------------------------------------------------------------------
D.local/bin/photo-drive-sync.sh | 40----------------------------------------
M.local/bin/tmux-fix-scaling.sh | 2+-
D.local/bin/youtube-channel-id | 43-------------------------------------------
6 files changed, 1 insertion(+), 214 deletions(-)

diff --git a/.local/bin/contactmenu b/.local/bin/contactmenu @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -set -e - -shopt -s nullglob globstar - -contact_files=~/.config/mutt/aliases - -contact=$(cat "${contact_files[@]}" | awk '{ print $2 }'| dmenu -i "$@") -[[ -n $contact ]] || exit 0 - -email=$(cat "${contact_files[@]}" | grep "$contact " | grep "@" | sed 's/.*<//;s/>.*//') - -echo "$email" | xclip -echo "$email" diff --git a/.local/bin/irg b/.local/bin/irg @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# Unfortunately, the single-char read syntax is not POSIX compatible, -# and backspace is not supported - -nl=' -' -query="" -echo -while :; do - printf "%s" "> $query" - read -sN1 -r q - case "$q" in - #("$backspace") # TODO - # query="${query%?}"; q="";; - ("$nl") - f="$(echo "$out" | sed -n '$s/:.*//p')"; clear; echo "$f"; exit 0;; - esac - query="${query}${q}" - out="$(rg --column --line-number --no-heading --color=always \ - --smart-case -f <(echo "$query"))" - printf "%s\n" "$out" -done diff --git a/.local/bin/message b/.local/bin/message @@ -1,94 +0,0 @@ -#!/usr/bin/env bash -set -e -#set -v - -keyboard-layout-switch.sh dk - -# server running macos -host="adamsgaard.dk" -user="ad" -port="12344" - -version=1.0 - -function show_help { - echo "usage: ${0##*/} [OPTIONS] RECIPIENT [RECIPIENT2 [RECIPIENT N]]" - echo "will send stdin to recipients through $user@$host" - echo "OPTIONS are one or more of the following:" - echo " -p, --prompt show interactive dmenu prompt, otherwise read stdin" - echo " -h, --help show this message" - echo " -v, --version show version and license information" - echo " -- do not consider any following arguments as options" - echo "${0##*/} requires ssh access to the system." - echo "Example with stdin:" - echo " echo 'hi' | message 'Jack Jackson'" -} - -function show_version { - echo "${0##*/} version $version" - echo "Licensed under the GNU Public License, v3+" - echo "written by Anders Damsgaard, anders@adamsgaard.dk" - echo "https://gitlab.com/admesg/dotfiles" -} - -function die { - printf '%s\n' "$1" >&2 - keyboard-layout-switch.sh us - exit 1 -} - - -prompt=0 -while :; do - case "$1" in - -h|-\?|--help) - show_help - keyboard-layout-switch.sh us - exit 0 - ;; - -v|--version) - show_version - keyboard-layout-switch.sh us - exit 0 - ;; - -p|--prompt) - prompt=1 - ;; - --) # end all options - shift - break - ;; - -?*) - die 'Error: Unknown option specified' - ;; - *) # No more options - break - esac - shift -done - - -function send_message { - cmd="osascript -e 'tell application \"Messages\" to send \"$2\" to buddy \"$1\"'" - ssh -q -p "$port" "$user"@"$host" -t "$cmd" -} - -if [ "$prompt" = 1 ]; then - names="Susan Louise Damsgaard Sonnesen\nAnders Damsgaard\nJesper Hannibalsen\nSimon Svendsen\nNiels Christensen\nAnne Grethe Damsgaard Christensen\nLars Damsgaard Fink" - recipient=$(echo -e "${names[@]}" | dmenu -i -p "To:" || exit 1) - msg="$(echo ' ' | dmenu -i -p 'Message:')" - send_message "$recipient" "$msg" - keyboard-layout-switch.sh us - exit 0 -else - # stdin - [ $# -lt 1 ] && die 'Error: No RECIPIENT[S] specified' - msg="$(cat)" -fi - -# loop over RECIPIENT[S] -for recipient in "$@"; do - send_message "$recipient" "$msg" -done - -keyboard-layout-switch.sh us diff --git a/.local/bin/photo-drive-sync.sh b/.local/bin/photo-drive-sync.sh @@ -1,40 +0,0 @@ -#!/bin/bash - -diskA=/Volumes/SUSAN -diskB=/Volumes/backup - -echo "Copying from local drive to first external drive ($diskA)" - -# Lightroom -echo "Copying Lightroom files to first external drive ($diskA)" -rsync -rav --progress ~/Pictures/Lightroom $diskA/Anders\ flaptop/ -rsync -rav --progress ~/iCloud/Lightroom-exports $diskA/Anders\ flaptop/ - -# Capture One -echo "Copying Capture One files to first external drive ($diskA)" -rsync -rav --progress --delete ~/Pictures/Capture\ One\ Catalog.cocatalog $diskA/Anders\ flaptop/ -rsync -rav --progress ~/Pictures/CaptureOne\ exports $diskA/Anders\ flaptop/ - -# Photos.app -echo "Copying Photos.app files to first external drive ($diskA)" -rsync -rav --progress ~/Pictures/Photos\ Library.photoslibrary $diskA/Anders\ flaptop/ -rsync -rav --progress ~/Pictures/Photos\ exports $diskA/Anders\ flaptop/ - -if [ -d $diskB ]; then - echo "Mirroring external drives ($diskA -> $diskB)" - rsync -rav --delete --exclude="/.*" --progress $diskA/ $diskB -fi - -read -p "Unmount external drive $diskA? [y/N] " -n 1 -r -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then - diskutil eject $diskA -fi - -if [ -d $diskB ]; then - read -p "Unmount external drive $diskB? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - diskutil eject $diskB - fi -fi diff --git a/.local/bin/tmux-fix-scaling.sh b/.local/bin/tmux-fix-scaling.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh status_width=`echo "$(tput cols)/3"|bc|tr -d '\n'` tmux new-window -n resize \ "tmux set status-right-length $status_width; tmux set status-left-length $status_width" diff --git a/.local/bin/youtube-channel-id b/.local/bin/youtube-channel-id @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -function help { - echo "Usage: ${0##*/} [add] <youtube-url>" - echo "or: ${0##*/} [add] <youtube-channel-name>" - echo "if the optional command 'add' is used, the channel is added to the " - echo "r2e feed list" -} - -[ $# -lt 1 ] && help && exit 1 -[ "$1" = "-h" ] && help && exit 0 -[ "$1" = "--help" ] && help && exit 0 - -[ $# -eq 1 ] && url="$1" -[ $# -eq 2 ] && url="$2" - -# detect if url or just channel name -if ! [[ "$url" =~ ^(http:\/\/|https:\/\/).*$ ]]; then - url="https://www.youtube.com/user/$url" -fi - -id="$(curl --silent "$url" | \ - grep 'data-channel-external-id' | \ - sed 's/.*data-channel-external-id="//' | \ - sed 's/".*//' | \ - sed '1q')" -name="$(echo "$url" | sed 's/.*\///' )" - -if [ ! -n "$id" ]; then - echo "channel $name not found" - exit 1 -fi - -if [ "$1" = "add" ]; then - r2e add "youtube_${name}" \ - "https://www.youtube.com/feeds/videos.xml?channel_id=${id}" - echo "$name ($id) added" -else - echo "$id" - if type xclip >/dev/null 2>&1; then - echo "$id" | xclip - fi -fi