summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bash_completion.d/pass.bash-completion144
-rw-r--r--bash_completion.d/poetry.bash-completion140
-rw-r--r--bash_completion.d/task.sh192
-rw-r--r--bash_functions.d/dotf.sh3
-rw-r--r--bash_functions.d/get-location-from-ip.sh3
-rw-r--r--bash_functions.d/listen-to-yt.sh6
-rw-r--r--bash_functions.d/screenshot.sh4
-rw-r--r--bash_functions.d/tj.sh3
-rw-r--r--bash_functions.d/weather.sh3
-rw-r--r--bash_profile4
10 files changed, 502 insertions, 0 deletions
diff --git a/bash_completion.d/pass.bash-completion b/bash_completion.d/pass.bash-completion
new file mode 100644
index 0000000..2d23cbf
--- /dev/null
+++ b/bash_completion.d/pass.bash-completion
@@ -0,0 +1,144 @@
+# completion file for bash
+
+# Copyright (C) 2012 - 2014 Jason A. Donenfeld <Jason@zx2c4.com> and
+# Brian Mattern <rephorm@rephorm.com>. All Rights Reserved.
+# This file is licensed under the GPLv2+. Please see COPYING for more information.
+
+_pass_complete_entries () {
+ local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+ prefix="${prefix%/}/"
+ local suffix=".gpg"
+ local autoexpand=${1:-0}
+
+ local IFS=$'\n'
+ local items=($(compgen -f $prefix$cur))
+
+ # Remember the value of the first item, to see if it is a directory. If
+ # it is a directory, then don't add a space to the completion
+ local firstitem=""
+ # Use counter, can't use ${#items[@]} as we skip hidden directories
+ local i=0 item
+
+ for item in ${items[@]}; do
+ [[ $item =~ /\.[^/]*$ ]] && continue
+
+ # if there is a unique match, and it is a directory with one entry
+ # autocomplete the subentry as well (recursively)
+ if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
+ while [[ -d $item ]]; do
+ local subitems=($(compgen -f "$item/"))
+ local filtereditems=( ) item2
+ for item2 in "${subitems[@]}"; do
+ [[ $item2 =~ /\.[^/]*$ ]] && continue
+ filtereditems+=( "$item2" )
+ done
+ if [[ ${#filtereditems[@]} -eq 1 ]]; then
+ item="${filtereditems[0]}"
+ else
+ break
+ fi
+ done
+ fi
+
+ # append / to directories
+ [[ -d $item ]] && item="$item/"
+
+ item="${item%$suffix}"
+ COMPREPLY+=("${item#$prefix}")
+ if [[ $i -eq 0 ]]; then
+ firstitem=$item
+ fi
+ let i+=1
+ done
+
+ # The only time we want to add a space to the end is if there is only
+ # one match, and it is not a directory
+ if [[ $i -gt 1 || ( $i -eq 1 && -d $firstitem ) ]]; then
+ compopt -o nospace
+ fi
+}
+
+_pass_complete_folders () {
+ local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+ prefix="${prefix%/}/"
+
+ local IFS=$'\n'
+ local items=($(compgen -d $prefix$cur))
+ for item in ${items[@]}; do
+ [[ $item == $prefix.* ]] && continue
+ COMPREPLY+=("${item#$prefix}/")
+ done
+}
+
+_pass_complete_keys () {
+ local GPG="gpg"
+ command -v gpg2 &>/dev/null && GPG="gpg2"
+
+ local IFS=$'\n'
+ # Extract names and email addresses from gpg --list-keys
+ local keys="$($GPG --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
+ COMPREPLY+=($(compgen -W "${keys}" -- ${cur}))
+}
+
+_pass()
+{
+ COMPREPLY=()
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local commands="init ls find grep show insert generate edit rm mv cp git help version ${PASSWORD_STORE_EXTENSION_COMMANDS[*]}"
+ if [[ $COMP_CWORD -gt 1 ]]; then
+ local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
+ case "${COMP_WORDS[1]}" in
+ init)
+ if [[ $lastarg == "-p" || $lastarg == "--path" ]]; then
+ _pass_complete_folders
+ compopt -o nospace
+ else
+ COMPREPLY+=($(compgen -W "-p --path" -- ${cur}))
+ _pass_complete_keys
+ fi
+ ;;
+ ls|list|edit)
+ _pass_complete_entries
+ ;;
+ show|-*)
+ COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
+ _pass_complete_entries 1
+ ;;
+ insert)
+ COMPREPLY+=($(compgen -W "-e --echo -m --multiline -f --force" -- ${cur}))
+ _pass_complete_entries
+ ;;
+ generate)
+ COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place" -- ${cur}))
+ _pass_complete_entries
+ ;;
+ cp|copy|mv|rename)
+ COMPREPLY+=($(compgen -W "-f --force" -- ${cur}))
+ _pass_complete_entries
+ ;;
+ rm|remove|delete)
+ COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur}))
+ _pass_complete_entries
+ ;;
+ git)
+ COMPREPLY+=($(compgen -W "init push pull config log reflog rebase" -- ${cur}))
+ ;;
+ esac
+
+ # To add completion for an extension command define a function like this:
+ # __password_store_extension_complete_<COMMAND>() {
+ # COMPREPLY+=($(compgen -W "-o --option" -- ${cur}))
+ # _pass_complete_entries 1
+ # }
+ #
+ # and add the command to the $PASSWORD_STORE_EXTENSION_COMMANDS array
+ if [[ " ${PASSWORD_STORE_EXTENSION_COMMANDS[*]} " == *" ${COMP_WORDS[1]} "* ]] && type "__password_store_extension_complete_${COMP_WORDS[1]}" &> /dev/null; then
+ "__password_store_extension_complete_${COMP_WORDS[1]}"
+ fi
+ else
+ COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
+ _pass_complete_entries 1
+ fi
+}
+
+complete -o filenames -F _pass pass
diff --git a/bash_completion.d/poetry.bash-completion b/bash_completion.d/poetry.bash-completion
new file mode 100644
index 0000000..19a7e04
--- /dev/null
+++ b/bash_completion.d/poetry.bash-completion
@@ -0,0 +1,140 @@
+_poetry_3a61cd031c563512_complete()
+{
+ local cur script coms opts com
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur words
+
+ # for an alias, get the real script behind it
+ if [[ $(type -t ${words[0]}) == "alias" ]]; then
+ script=$(alias ${words[0]} | sed -E "s/alias ${words[0]}='(.*)'/\1/")
+ else
+ script=${words[0]}
+ fi
+
+ # lookup for command
+ for word in ${words[@]:1}; do
+ if [[ $word != -* ]]; then
+ com=$word
+ break
+ fi
+ done
+
+ # completing for an option
+ if [[ ${cur} == --* ]] ; then
+ opts="--ansi --help --no-ansi --no-interaction --quiet --verbose --version"
+
+ case "$com" in
+
+ (about)
+ opts="${opts} "
+ ;;
+
+ (add)
+ opts="${opts} --allow-prereleases --dev --dry-run --extras --lock --optional --platform --python --source"
+ ;;
+
+ (build)
+ opts="${opts} --format"
+ ;;
+
+ (cache)
+ opts="${opts} "
+ ;;
+
+ (check)
+ opts="${opts} "
+ ;;
+
+ (config)
+ opts="${opts} --list --local --unset"
+ ;;
+
+ (debug)
+ opts="${opts} "
+ ;;
+
+ (env)
+ opts="${opts} "
+ ;;
+
+ (export)
+ opts="${opts} --dev --extras --format --output --with-credentials --without-hashes"
+ ;;
+
+ (help)
+ opts="${opts} "
+ ;;
+
+ (init)
+ opts="${opts} --author --dependency --description --dev-dependency --license --name --python"
+ ;;
+
+ (install)
+ opts="${opts} --dry-run --extras --no-dev --no-root --remove-untracked"
+ ;;
+
+ (lock)
+ opts="${opts} --no-update"
+ ;;
+
+ (new)
+ opts="${opts} --name --src"
+ ;;
+
+ (publish)
+ opts="${opts} --build --cert --client-cert --dry-run --password --repository --username"
+ ;;
+
+ (remove)
+ opts="${opts} --dev --dry-run"
+ ;;
+
+ (run)
+ opts="${opts} "
+ ;;
+
+ (search)
+ opts="${opts} "
+ ;;
+
+ (self)
+ opts="${opts} "
+ ;;
+
+ (shell)
+ opts="${opts} "
+ ;;
+
+ (show)
+ opts="${opts} --all --latest --no-dev --outdated --tree"
+ ;;
+
+ (update)
+ opts="${opts} --dry-run --lock --no-dev"
+ ;;
+
+ (version)
+ opts="${opts} --short"
+ ;;
+
+ esac
+
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ __ltrim_colon_completions "$cur"
+
+ return 0;
+ fi
+
+ # completing for a command
+ if [[ $cur == $com ]]; then
+ coms="about add build cache check config debug env export help init install lock new publish remove run search self shell show update version"
+
+ COMPREPLY=($(compgen -W "${coms}" -- ${cur}))
+ __ltrim_colon_completions "$cur"
+
+ return 0
+ fi
+}
+
+complete -o default -F _poetry_3a61cd031c563512_complete poetry
+complete -o default -F _poetry_3a61cd031c563512_complete /home/lemon/.poetry/bin/poetry
diff --git a/bash_completion.d/task.sh b/bash_completion.d/task.sh
new file mode 100644
index 0000000..ac07c09
--- /dev/null
+++ b/bash_completion.d/task.sh
@@ -0,0 +1,192 @@
+################################################################################
+#
+# Copyright 2006 - 2020, Paul Beckingham, Federico Hernandez.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "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.
+#
+# https://www.opensource.org/licenses/mit-license.php
+#
+################################################################################
+#
+# The routines will do completion of:
+#
+# *) task subcommands
+# *) project names
+# *) tag names
+# *) aliases
+#
+# To use these routines:
+#
+# 1) Copy this file to somewhere (e.g. ~/.bash_completion.d/task.sh).
+# 2) Add the following line to your .bashrc:
+# source ~/.bash_completion.d/task.sh
+#
+# OR
+#
+# 3) Copy the file to /etc/bash_completion.d
+# 4) source /etc/bash_completion
+#
+# To submit patches/bug reports:
+#
+# *) Go to the project's website at
+#
+# http://taskwarrior.org
+#
+################################################################################
+#the following variable is substituted for by ../../test/bash_completion.t
+taskcommand='task rc.verbose:nothing rc.confirmation:no rc.hooks:off'
+
+_task_get_tags() {
+ $taskcommand _tags
+}
+
+_task_get_config() {
+ $taskcommand _config
+}
+
+_task_offer_priorities() {
+ COMPREPLY=( $(compgen -W "L M H" -- ${cur/*:/}) )
+}
+
+_task_offer_projects() {
+ COMPREPLY=( $(compgen -W "$($taskcommand _projects)" -- ${cur/*:/}) )
+}
+
+_task_offer_contexts() {
+ COMPREPLY=( $(compgen -W "$($taskcommand _context) define delete list none show" -- $cur) )
+}
+
+_task_context_alias=$($taskcommand show | grep 'alias.*context' | cut -d' ' -f1 | cut -d. -f2)
+
+_task()
+{
+ local cur prev opts base
+
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ if [ ${#COMP_WORDS[*]} -gt 2 ]
+ then
+ prev2="${COMP_WORDS[COMP_CWORD-2]}"
+ else
+ prev2=""
+ fi
+# useful for debugging:
+# echo -e "\ncur='$cur'"
+# echo "prev='$prev'"
+# echo "prev2='$prev2'"
+
+ abbrev_min=$($taskcommand show | grep "abbreviation.minimum" | awk {'print $2'})
+ commands_aliases=$(echo $($taskcommand _commands; $taskcommand _aliases) | tr " " "\n"|sort|tr "\n" " ")
+ opts="$commands_aliases $($taskcommand _columns)"
+
+ case "${prev}" in
+ $_task_context_alias|cont|conte|contex|context)
+ _task_offer_contexts
+ return 0
+ ;;
+ :)
+ case "${prev2}" in
+ pri|prior|priori|priorit|priority)
+ if [ ${#prev2} -ge $abbrev_min ]; then
+ _task_offer_priorities
+ fi
+ return 0
+ ;;
+ pro|proj|proje|projec|project)
+ if [ ${#prev2} -ge $abbrev_min ]; then
+ _task_offer_projects
+ fi
+ return 0
+ ;;
+ rc)
+ # not activated when only "rc:" but is activated if anything after "rc:"
+ _filedir
+ return 0
+ ;;
+ rc.data.location)
+ _filedir -d
+ return 0
+ ;;
+ esac
+ ;;
+ *)
+ case "${cur}" in
+ pro:*|proj:*|proje:*|projec:*|project:*)
+ _task_offer_projects
+ return 0
+ ;;
+ :)
+ case "${prev}" in
+ pri|prior|priori|priorit|priority)
+ if [ ${#prev} -ge $abbrev_min ]; then
+ _task_offer_priorities
+ fi
+ return 0
+ ;;
+ pro|proj|proje|projec|project)
+ if [ ${#prev} -ge $abbrev_min ]; then
+ _task_offer_projects
+ fi
+ return 0
+ ;;
+ rc)
+ # activated only when "rc:"
+ cur="" # otherwise ":" is passed.
+ _filedir
+ return 0
+ ;;
+ rc.data.location)
+ cur=""
+ _filedir -d
+ return 0
+ ;;
+ esac
+ ;;
+ +*)
+ local tags=$(_task_get_tags | sed 's/^/+/')
+ COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
+ return 0
+ ;;
+ -*)
+ local tags=$(_task_get_tags | sed 's/^/-/')
+ COMPREPLY=( $(compgen -W "${tags}" -- ${cur}) )
+ return 0
+ ;;
+ rc.*)
+ local config=$(_task_get_config | sed -e 's/^/rc\./' -e 's/$/:/')
+ COMPREPLY=( $(compgen -W "${config}" -- ${cur}) )
+ return 0
+ ;;
+ *)
+ case "${prev}" in
+ import)
+ COMPREPLY=( $(compgen -o "default" -- ${cur}) )
+ return 0
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+}
+complete -o nospace -F _task task
diff --git a/bash_functions.d/dotf.sh b/bash_functions.d/dotf.sh
new file mode 100644
index 0000000..932e442
--- /dev/null
+++ b/bash_functions.d/dotf.sh
@@ -0,0 +1,3 @@
+dotf() {
+ cd ~/openbsd-dotfiles
+}
diff --git a/bash_functions.d/get-location-from-ip.sh b/bash_functions.d/get-location-from-ip.sh
new file mode 100644
index 0000000..840de2b
--- /dev/null
+++ b/bash_functions.d/get-location-from-ip.sh
@@ -0,0 +1,3 @@
+get-location-from-ip() {
+ curl -s https://ipvigilante.com/$(curl -s https://ipinfo.io/ip) | jq '.data.latitude, .data.longitude, .data.city_name, .data.country_name'
+}
diff --git a/bash_functions.d/listen-to-yt.sh b/bash_functions.d/listen-to-yt.sh
new file mode 100644
index 0000000..fa9548c
--- /dev/null
+++ b/bash_functions.d/listen-to-yt.sh
@@ -0,0 +1,6 @@
+# Listen to a song on You Tube
+listen-to-yt() {
+if [[ -z "$1" ]]; then
+ echo "Enter a search string!";
+else mpv "$(yt-dlp --default-search 'ytsearch1:' \"$1\" --get-url | tail -1)"; fi
+}
diff --git a/bash_functions.d/screenshot.sh b/bash_functions.d/screenshot.sh
new file mode 100644
index 0000000..34f9c7a
--- /dev/null
+++ b/bash_functions.d/screenshot.sh
@@ -0,0 +1,4 @@
+screenshot() {
+ sleep 4 && scrot '%Y-%m-%d_$wx$h.png' -e 'optipng $f' -shole --line color="Dark Salmon",opacity=200
+}
+
diff --git a/bash_functions.d/tj.sh b/bash_functions.d/tj.sh
new file mode 100644
index 0000000..a0b6712
--- /dev/null
+++ b/bash_functions.d/tj.sh
@@ -0,0 +1,3 @@
+tj() {
+ vim ~/Notes/journal/$(date +%Y-%m-%d).md
+}
diff --git a/bash_functions.d/weather.sh b/bash_functions.d/weather.sh
new file mode 100644
index 0000000..5b2c707
--- /dev/null
+++ b/bash_functions.d/weather.sh
@@ -0,0 +1,3 @@
+weathertoss() {
+ curl wttr.in/~Berwick-upon-Tweed
+}
diff --git a/bash_profile b/bash_profile
new file mode 100644
index 0000000..97f247e
--- /dev/null
+++ b/bash_profile
@@ -0,0 +1,4 @@
+f [ -f ~/.bashrc ]; then . ~/.bashrc; fi
+
+eval `ssh-agent -s`
+ssh-add