diff options
author | Ryan Kavanagh <rak@rak.ac> | 2021-12-13 15:53:55 -0500 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2021-12-13 15:53:55 -0500 |
commit | d87bd3ddaa696c6a60528d99783aa33db6e8f214 (patch) | |
tree | 7c665bef4e2da83e1e9f51419284c7907195732c /bin | |
parent | Switch to powerline10k prompt after god knows how many years of wunjo (diff) |
Drop a bunch of old config files
Diffstat (limited to '')
-rwxr-xr-x | bin/gpg-check | 17 | ||||
-rwxr-xr-x | bin/mutt-autoalias | 16 | ||||
-rwxr-xr-x | bin/mutt-notmuch | 190 | ||||
-rwxr-xr-x | bin/sdf | 8 | ||||
-rwxr-xr-x | bin/sp | 272 | ||||
-rwxr-xr-x | bin/vpnc | 4 |
6 files changed, 0 insertions, 507 deletions
diff --git a/bin/gpg-check b/bin/gpg-check deleted file mode 100755 index 79948c9..0000000 --- a/bin/gpg-check +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -MSG=$(cat) - -echo "${MSG}" | grep 'BEGIN PGP SIGNATURE' > /dev/null 2>&1; -SIGNED=$? - -if [ ${SIGNED} = 0 ]; then - echo "${MSG}" | \ - sed -e '/^-\+BEGIN PGP SIGNED MESSAGE-\+/,/^Hash:.*/d' \ - -e '/^-\+BEGIN PGP SIGNATURE-\+/,$d' | \ - mutt-autoalias - echo '\n' - echo "${MSG}" | gpg --verify - 2>&1; -else - echo "${MSG}" | mutt-autoalias -fi diff --git a/bin/mutt-autoalias b/bin/mutt-autoalias deleted file mode 100755 index a9725d5..0000000 --- a/bin/mutt-autoalias +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -MESSAGE=$(cat) - -EXCLUDE="\(.*@bugs.\(debian.org|launchpad.net\)|.*@.*.launchpad.net|noreply|.*facebook.*|.*gmail.com.*Behalf Of\)" -NEWALIAS=$(echo "${MESSAGE}" | grep ^"From: " | egrep -v "${EXCLUDE}" | sed s/[\,\"\']//g | awk '{$1=""; if (NF == 3) {print "alias" $0;} else if (NF == 2) {print "alias" $0 $0;} else if (NF > 3) {print "alias", tolower($(NF-1))"."tolower($2) $0;}}') - -if grep -Fxq "$NEWALIAS" $HOME/.mutt/alias.rc; then - : -elif [ "x${NEWALIAS}" = "x" ]; then - : -else - echo "$NEWALIAS" >> $HOME/.mutt/alias.rc -fi - -echo "${MESSAGE}" diff --git a/bin/mutt-notmuch b/bin/mutt-notmuch deleted file mode 100755 index a5b339a..0000000 --- a/bin/mutt-notmuch +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/perl -w -# -# mutt-notmuch - notmuch (of a) helper for Mutt -# -# Copyright: © 2011 Stefano Zacchiroli <zack@upsilon.cc> -# License: GNU General Public License (GPL), version 3 or above -# -# See the bottom of this file for more documentation. -# A manpage can be obtained by running "pod2man mutt-notmuch > mutt-notmuch.1" - -use strict; -use warnings; - -use File::Path; -use Getopt::Long; -use Mail::Internet; -use Mail::Box::Maildir; -use Pod::Usage; - - -# create an empty maildir (if missing) or empty an existing maildir" -sub empty_maildir($) { - my ($maildir) = (@_); - rmtree($maildir) if (-d $maildir); - my $folder = new Mail::Box::Maildir(folder => $maildir, - create => 1); - $folder->close(); -} - -# search($maildir, $query) -# search mails according to $query with notmuch; store results in $maildir -sub search($$) { - my ($maildir, $query) = @_; - - empty_maildir($maildir); - system("notmuch search --output=files $query" - . " | sed -e 's: :\\\\ :g'" - . " | xargs --no-run-if-empty ln -s -t $maildir/cur/"); -} - -sub search_action($$@) { - my ($interactive, $results_dir, @params) = @_; - - if (! $interactive) { - search($results_dir, join(' ', @params)); - } else { - my $query = ""; - my $done = 0; - while (! $done) { - print "search ('?' for man): "; - chomp($query = <STDIN>); - if ($query eq "?") { - system("man notmuch"); - } elsif ($query eq "") { - $done = 1; # quit doing nothing - } else { - search($results_dir, $query); - $done = 1; - } - } - } -} - -sub thread_action(@) { - my ($results_dir, @params) = @_; - - my $mail = Mail::Internet->new(\*STDIN); - $mail->head->get('message-id') =~ /^<(.*)>$/; # get message-id - my $mid = $1; - my $tid = `notmuch search --output=threads id:$mid`;# get thread id - chomp($tid); - - search($results_dir, $tid); -} - -sub die_usage() { - my %podflags = ( "verbose" => 1, - "exitval" => 2 ); - pod2usage(%podflags); -} - -sub main() { - my $results_dir = "$ENV{HOME}/.cache/mutt_results"; - my $interactive = 0; - my $help_needed = 0; - - my $getopt = GetOptions( - "h|help" => \$help_needed, - "o|output-dir=s" => \$results_dir, - "p|prompt" => \$interactive); - if (! $getopt || $#ARGV < 0) { die_usage() }; - my ($action, @params) = ($ARGV[0], @ARGV[1..$#ARGV]); - - if ($help_needed) { - die_usage(); - } elsif ($action eq "search" && $#ARGV == 0 && ! $interactive) { - print STDERR "Error: no search term provided\n\n"; - die_usage(); - } elsif ($action eq "search") { - search_action($interactive, $results_dir, @params); - } elsif ($action eq "thread") { - thread_action($results_dir, @params); - } else { - die_usage(); - } -} - -main(); - -__END__ - -=head1 NAME - -mutt-notmuch - notmuch (of a) helper for Mutt - -=head1 SYNOPSIS - -=over - -=item B<mutt-notmuch> [I<OPTION>]... search [I<SEARCH-TERM>]... - -=item B<mutt-notmuch> [I<OPTION>]... thread < I<MAIL> - -=back - -=head1 DESCRIPTION - -mutt-notmuch is a frontend to the notmuch mail indexer capable of populating -maildir with search results. - -=head1 OPTIONS - -=over 4 - -=item -o DIR - -=item --output-dir DIR - -Store search results as (symlink) messages under maildir DIR. Beware: DIR will -be overwritten. (Default: F<~/.cache/mutt_results/>) - -=item -p - -=item --prompt - -Instead of using command line search terms, prompt the user for them (only for -"search"). - -=item -h - -=item --help - -Show usage information and exit. - -=back - -=head1 INTEGRATION WITH MUTT - -mutt-notmuch can be used to integrate notmuch with the Mutt mail user agent -(unsurprisingly, given the name). To that end, you should define the following -macros in your F<~/.muttrc> (replacing F<~/bin/mutt-notmuch> for the actual -location of mutt-notmuch on your system): - - macro index <F8> \ - "<enter-command>unset wait_key<enter><shell-escape>~/bin/mutt-notmuch --prompt search<enter><change-folder-readonly>~/.cache/mutt_results<enter>" \ - "search mail (using notmuch)" - macro index <F9> \ - "<enter-command>unset wait_key<enter><pipe-message>~/bin/mutt-notmuch thread<enter><change-folder-readonly>~/.cache/mutt_results<enter><enter-command>set wait_key<enter>" \ - "search and reconstruct owning thread (using notmuch)" - -The first macro (activated by <F8>) will prompt the user for notmuch search -terms and then jump to a temporary maildir showing search results. The second -macro (activated by <F9>) will reconstruct the thread corresponding to the -current mail and show it as search results. - -To keep notmuch index current you should then periodically run C<notmuch -new>. Depending on your local mail setup, you might want to do that via cron, -as a hook triggered by mail retrieval, etc. - -=head1 SEE ALSO - -mutt(1), notmuch(1) - -=head1 AUTHOR - -Copyright: (C) 2011 Stefano Zacchiroli <zack@upsilon.cc> - -License: GNU General Public License (GPL), version 3 or higher - -=cut diff --git a/bin/sdf b/bin/sdf deleted file mode 100755 index 824af51..0000000 --- a/bin/sdf +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -SDF=faeroes.sdf.org - -tmux new-session -A -s sdf -d -n com "ssh -t ${SDF} rcom" -tmux set-option -t sdf:^ default-command "ssh -t ${SDF}" -tmux set-option -t sdf:^ remain-on-exit on -tmux attach -t sdf @@ -1,272 +0,0 @@ -#!/usr/bin/env bash - -# -# This is sp, the command-line Spotify controller. It talks to a running -# instance of the Spotify Linux client over dbus, providing an interface not -# unlike mpc. -# -# Put differently, it allows you to control Spotify without leaving the comfort -# of your command line, and without a custom client or Premium subscription. -# -# As an added bonus, it also works with ssh, at and cron. -# -# Example: -# $ sp weather girls raining men -# $ sp current -# Album 100 Hits Of The '80s -# Artist The Weather Girls -# Title It's Raining Men -# $ sp pause -# -# Alarm clock example: -# $ at 7:45 <<< 'sp bangarang' -# -# Remote example: -# $ ssh vader@prod02.nomoon.ta 'sp imperial march' -# -# -# Copyright (C) 2013 Wander Nauta -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software, to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to permit -# persons to whom the Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# The software is provided "as is", without warranty of any kind, express or -# implied, including but not limited to the warranties of merchantability, -# fitness for a particular purpose and noninfringement. In no event shall the -# authors or copyright holders be liable for any claim, damages or other -# liability, whether in an action of contract, tort or otherwise, arising from, -# out of or in connection with the software or the use or other dealings in the -# software. -# - -# CONSTANTS - -SP_VERSION="0.1" -SP_DEST="org.mpris.MediaPlayer2.spotify" -SP_PATH="/org/mpris/MediaPlayer2" -SP_MEMB="org.mpris.MediaPlayer2.Player" - -# SHELL OPTIONS - -shopt -s expand_aliases - -# UTILITY FUNCTIONS - -function require { - hash $1 2>/dev/null || { - echo >&2 "Error: '$1' is required, but was not found."; exit 1; - } -} - -# COMMON REQUIRED BINARIES - -# We need dbus-send to talk to Spotify. -require dbus-send - -# Assert standard Unix utilities are available. -require grep -require sed -require cut -require tr - -# 'SPECIAL' (NON-DBUS-ALIAS) COMMANDS - -function sp-dbus { - # Sends the given method to Spotify over dbus. - dbus-send --print-reply --dest=$SP_DEST $SP_PATH $SP_MEMB.$1 ${*:2} > /dev/null -} - -function sp-open { - # Opens the given spotify: URI in Spotify. - sp-dbus OpenUri string:$1 -} - -function sp-metadata { - # Prints the currently playing track in a parseable format. - - dbus-send \ - --print-reply `# We need the reply.` \ - --dest=$SP_DEST \ - $SP_PATH \ - org.freedesktop.DBus.Properties.Get \ - string:"$SP_MEMB" string:'Metadata' \ - | grep -Ev "^method" `# Ignore the first line.` \ - | grep -Eo '("(.*)")|(\b[0-9][a-zA-Z0-9.]*\b)' `# Filter interesting fiels.`\ - | sed -E '2~2 a|' `# Mark odd fields.` \ - | tr -d '\n' `# Remove all newlines.` \ - | sed -E 's/\|/\n/g' `# Restore newlines.` \ - | sed -E 's/(xesam:)|(mpris:)//' `# Remove ns prefixes.` \ - | sed -E 's/^"//' `# Strip leading...` \ - | sed -E 's/"$//' `# ...and trailing quotes.` \ - | sed -E 's/"+/|/' `# Regard "" as seperator.` \ - | sed -E 's/ +/ /g' `# Merge consecutive spaces.` -} - -function sp-current { - # Prints the currently playing track in a friendly format. - require column - - sp-metadata \ - | grep --color=never -E "(title)|(album)|(artist)" \ - | sed 's/^\(.\)/\U\1/' \ - | column -t -s'|' -} - -function sp-eval { - # Prints the currently playing track as shell variables, ready to be eval'ed - require sort - - sp-metadata \ - | grep --color=never -E "(title)|(album)|(artist)|(trackid)|(trackNumber)" \ - | sort -r \ - | sed 's/^\([^|]*\)\|/\U\1/' \ - | sed -E 's/\|/="/' \ - | sed -E 's/$/"/' \ - | sed -E 's/^/SPOTIFY_/' -} - -function sp-art { - # Prints the artUrl. - - sp-metadata | grep "artUrl" | cut -d'|' -f2 -} - -function sp-display { - # Calls display on the artUrl. - - require display - display $(sp-art) -} - -function sp-feh { - # Calls feh on the artURl. - - require feh - feh $(sp-art) -} - -function sp-url { - # Prints the HTTP url. - - TRACK=$(sp-metadata | grep "url" | cut -d'|' -f2 | cut -d':' -f3) - echo "http://open.spotify.com/track/$TRACK" -} - -function sp-clip { - # Copies the HTTP url. - - require xclip - sp-url | xclip -} - -function sp-http { - # xdg-opens the HTTP url. - - require xdg-open - xdg-open $(sp-url) -} - -function sp-help { - # Prints usage information. - - echo "Usage: sp [command]" - echo "Control a running Spotify instance from the command line." - echo "" - echo " sp play - Play/pause Spotify" - echo " sp pause - Pause Spotify" - echo " sp next - Go to next track" - echo " sp prev - Go to previous track" - echo "" - echo " sp current - Format the currently playing track" - echo " sp metadata - Dump the current track's metadata" - echo " sp eval - Return the metadata as a shell script" - echo "" - echo " sp art - Print the URL to the current track's album artwork" - echo " sp display - Display the current album artwork with \`display\`" - echo " sp feh - Display the current album artwork with \`feh\`" - echo "" - echo " sp url - Print the HTTP URL for the currently playing track" - echo " sp clip - Copy the HTTP URL to the X clipboard" - echo " sp http - Open the HTTP URL in a web browser" - echo "" - echo " sp open <uri> - Open a spotify: uri" - echo " sp search <q> - Start playing the best search result for the given query" - echo "" - echo " sp version - Show version information" - echo " sp help - Show this information" - echo "" - echo "Any other argument will start a search (i.e. 'sp foo' will search for foo)." -} - -function sp-search { - # Searches for tracks, plays the first result. - - require curl - - Q="$@" - SPTFY_URI=$( \ - curl -s -G --data-urlencode "q=$Q" https://api.spotify.com/v1/search\?type=track \ - | grep -E -o "spotify:track:[a-zA-Z0-9]+" -m 1 \ - ) - - sp-open $SPTFY_URI -} - -function sp-version { - # Prints version information. - - echo "sp $SP_VERSION" - echo "Copyright (C) 2013 Wander Nauta" - echo "License MIT" -} - -# 'SIMPLE' (DBUS-ALIAS) COMMANDS - -alias sp-play=" sp-dbus PlayPause" -alias sp-pause=" sp-dbus Pause" -alias sp-next=" sp-dbus Next" -alias sp-prev=" sp-dbus Previous" - -# DISPATCHER - -# First, we connect to the dbus session spotify is on. This isn't really needed -# when running locally, but is crucial when we don't have an X display handy -# (for instance, when running sp over ssh.) - -SPOTIFY_PID="$(pidof -s spotify || pidof -s .spotify-wrapped)" - -if [[ -z "$SPOTIFY_PID" ]]; then - echo "Error: Spotify is not running." - exit 1 -fi - -QUERY_ENVIRON="$(cat /proc/${SPOTIFY_PID}/environ | tr '\0' '\n' | grep "DBUS_SESSION_BUS_ADDRESS" | cut -d "=" -f 2-)" -if [[ "${QUERY_ENVIRON}" != "" ]]; then - export DBUS_SESSION_BUS_ADDRESS="${QUERY_ENVIRON}" -fi - -# Then we dispatch the command. - -subcommand="$1" - -if [[ -z "$subcommand" ]]; then - # No arguments given, print help. - sp-help -else - # Arguments given, check if it's a command. - if $(type sp-$subcommand > /dev/null 2> /dev/null); then - # It is. Run it. - shift - eval "sp-$subcommand $@" - else - # It's not. Try a search. - eval "sp-search $@" - fi -fi diff --git a/bin/vpnc b/bin/vpnc deleted file mode 100755 index 3933feb..0000000 --- a/bin/vpnc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -#sudo ipsec up $1 && sleep 1 && sudo xl2tpd-control connect $1 -sudo xl2tpd-control connect $1 |