diff options
Diffstat (limited to 'dot_local/bin')
-rw-r--r-- | dot_local/bin/executable_0 | 174 | ||||
-rw-r--r-- | dot_local/bin/executable_gg | 6 | ||||
-rw-r--r-- | dot_local/bin/executable_mail | 3 | ||||
-rw-r--r-- | dot_local/bin/executable_s | 44 | ||||
-rw-r--r-- | dot_local/bin/executable_screenshotit | 4 | ||||
-rw-r--r-- | dot_local/bin/executable_shorten-clipb | 3 | ||||
-rw-r--r-- | dot_local/bin/executable_wal | 13 | ||||
-rw-r--r-- | dot_local/bin/executable_xb | 28 |
8 files changed, 0 insertions, 275 deletions
diff --git a/dot_local/bin/executable_0 b/dot_local/bin/executable_0 deleted file mode 100644 index 95cab51..0000000 --- a/dot_local/bin/executable_0 +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh - -# init variables -version="v2022.11.03" -ENDPOINT="https://0.vern.cc" -flag_options=":hvcfe:s:" -long_flag_options="help,version,color,file,extension:,server:" -flag_version=0 -flag_help=0 -flag_file=0 -flag_colors=0 -flag_ext=0 -data="" -EXT="" - -# help message available via func -show_help() { - cat > /dev/stdout << END -pb [options] filename -or -(command-with-stdout) | pb - -Uploads a file or data to the tilde 0x0 paste bin - -OPTIONAL FLAGS: - -h | --help) Show this help - -v | --version) Show current version number - -f | --file) Explicitly interpret stdin as filename - -c | --color) Pretty color output - -s | --server server_address) Use alternative pastebin server address - -e | --extension bin_extension) Specify file extension used in the upload -END -} - -show_usage() { - cat > /dev/stdout << END -usage: pb [-hfvcux] [-s server_address] filename -END -} - -# helper for program exit, supports error codes and messages -die () { - msg="$1" - code="$2" - # exit code defaults to 1 - if printf "%s" "${code}" | grep -q '^[0-9]+$'; then - code=1 - fi - # output message to stdout or stderr based on code - if [ -n "${msg}" ]; then - if [ "${code}" -eq 0 ]; then - printf "%s\\n" "${msg}" - else - printf "%s%s%s\\n" "$ERROR" "${msg}" "$RESET" >&2 - fi - fi - exit "${code}" -} - -# attempt to parse options or die -if ! PARSED_ARGUMENTS=$(getopt -a -n pb -o ${flag_options} --long ${long_flag_options} -- "$@"); then - printf "pb: unknown option\\n" - show_usage - exit 2 -fi - -# For debugging: echo "PARSED_ARGUMENTS is $PARSED_ARGUMENTS" -eval set -- "$PARSED_ARGUMENTS" -while : -do - case "$1" in - -h | --help) flag_help=1 ; shift ;; - -v | --version) flag_version=1 ; shift ;; - -c | --color) flag_color=1 ; shift ;; - -f | --file) flag_file=1 ; shift ;; - -e | --extension) flag_ext=1; EXT="$2" ; shift 2 ;; - -s | --server) ENDPOINT="$2" ; shift 2 ;; - --) shift; break ;; - *) echo "Unexpected option: $1 - this should not happen." - show_usage ; die 3 ;; - esac -done - -# display current version -if [ ${flag_version} -gt 0 ]; then - printf "%s\\n" "${version}" - die "" 0 -fi - -# display help -if [ ${flag_help} -gt 0 ]; then - show_help - die "" 0 -fi - -# is not interactive shell, use stdin -if [ -t 0 ]; then - flag_file=1 -else - if [ ${flag_ext} -gt 0 ]; then - # short-circuit stdin access to ensure binary data is transferred to curl - curl -sF"file=@-;filename=null.${EXT}" "${ENDPOINT}" < /dev/stdin - exit 0 - else - data="$(cat < /dev/stdin )" - fi -fi - -# if data variable is empty (not a pipe) use params as fallback -if [ -z "$data" ]; then - data="$*" -fi - -# Colors -if [ ${flag_colors} -gt 0 ]; then - SUCCESS=$(tput setaf 190) - ERROR=$(tput setaf 196) - RESET=$(tput sgr0) -else - SUCCESS="" - ERROR="" - RESET="" -fi - -if [ ${flag_file} -gt 0 ]; then - # file mode - if [ -z "${data}" ]; then - # if no data - # print error message - printf "%sProvide data to upload%s\\n" "$ERROR" "$RESET" - elif [ ! -f "${data}" ]; then - # file not found with name provided - # print error messagse - printf "%s%s%s\\tFile not found.%s\\n" "$RESET" "${data}" "$ERROR" "$RESET" - # attempt to split data string (multi-line?) and upload each string as file - for f in ${data}; do - # if there's nothing to parse, skip this loop - if [ "$f" = "$data" ]; then - break; - fi - # check if file exists - if [ -f "${f}" ]; then - if [ ${flag_ext} -gt 0 ]; then - # send file to endpoint masked with new extension - result=$(curl -sF"file=@${f};filename=null.${EXT}" "${ENDPOINT}") - else - # send file to endpoint - result=$(curl -sF"file=@${f}" "${ENDPOINT}") - fi - printf "%s%s%s\\n" "$SUCCESS" "$result" "$RESET" - else - # print error message - printf "%sFile not found.%s\\n" "$ERROR" "$RESET" - fi - done - else - # data available in file - # send file to endpoint - result=$(curl -sF"file=@${data}" "${ENDPOINT}") - printf "%s%s%s\\n" "$SUCCESS" "$result" "$RESET" - fi -else - # non-file mode - if [ -z "${data}" ]; then - # if no data - # print error message - printf "%sNo data found for upload. Please try again.%s\\n" "$ERROR" "$RESET" - else - # data available - # send data to endpoint - result=$(printf "%s" "${data}" | curl -sF"file=@-;filename=null.txt" "${ENDPOINT}") - printf "%s%s%s\\n" "$SUCCESS" "$result" "$RESET" - fi -fi diff --git a/dot_local/bin/executable_gg b/dot_local/bin/executable_gg deleted file mode 100644 index a8a2150..0000000 --- a/dot_local/bin/executable_gg +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -POSTDATE="$(date '+%Y-%m-%d %H:%M %:::z')\n\n" - -$EDITOR /tmp/gemlog-post.txt && sed -i "2s\`^.*$\`\n## $POSTDATE$(cat /tmp/gemlog-post.txt)\n\n-----\n\`" "$HOME/docs/src/gmi/tinylog.gmi" -cd "$HOME"/docs/src/gmi/; git diff diff --git a/dot_local/bin/executable_mail b/dot_local/bin/executable_mail deleted file mode 100644 index d06c220..0000000 --- a/dot_local/bin/executable_mail +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -claws-mail --alternate-config-dir $XDG_DATA_HOME/claws-mail - diff --git a/dot_local/bin/executable_s b/dot_local/bin/executable_s deleted file mode 100644 index e222ea7..0000000 --- a/dot_local/bin/executable_s +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -case $1 in - cf) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim -s > "$HOME/media/screenshots/$filename" - xclip -sel clipb -t image/png "$HOME/media/screenshots/$filename" - ;; - cl) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim -s > $HOME/media/screenshots/$filename - curl -F"file=@$HOME/media/screenshots/$filename" -Fsecret= "https://0.vern.cc/" | xclip -sel clipb - ;; - wf) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim -i $(xdotool getactivewindow) > "$HOME/media/screenshots/$filename" - xclip -sel clipb -t image/png "$HOME/media/screenshots/$filename" - ;; - wl) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim -i $(xdotool getactivewindow) > $HOME/media/screenshots/$filename - curl -F"file=@$HOME/media/screenshots/$filename" -Fsecret= "https://0.vern.cc/" | xclip -sel clipb - ;; - ff) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim > "$HOME/media/screenshots/$filename" - xclip -sel clipb -t image/png "$HOME/media/screenshots/$filename" - ;; - fl) - filename="$(date '+%d_%m_%Y-%H_%M_%s').png" - maim > $HOME/media/screenshots/$filename - curl -F"file=@$HOME/media/screenshots/$filename" -Fsecret= "https://0.vern.cc/" | xclip -sel clipb - ;; - *) - echo "Usage info:" - echo - echo "s cf - Takes a screenshot from a region and then copies the file to the clipboard selection" - echo "s cl - Takes a screenshot from a region and then uploads it to 0.vern.cc, and automatically copies the link" - echo "s wf - Takes a screenshot from the active window and then copies the file to the clipboard selection" - echo "s wl - Takes a screenshot from the active window and then uploads it to 0.vern.cc, and automatically copies the link" - echo "s ff - Takes a screenshot of the full screen and then copies the file to the clipboard selection" - echo "s fl - Takes a screenshot of the full screen and then uploads it to 0.vern.cc, and automatically copies the link" - echo - echo "Notice: all of these commands output it's screenshots to \`~/media/screenshots/\`." -esac diff --git a/dot_local/bin/executable_screenshotit b/dot_local/bin/executable_screenshotit deleted file mode 100644 index 5808b4a..0000000 --- a/dot_local/bin/executable_screenshotit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -printf "Fullscreen, copy file (ff)\nFullscreen, copy link (fl)\nWindow, copy file (wf)\nWindow, copy link (wl)\nRegion, copy file (rf)\nRegion, copy link (rl)" | dmenu -l 6 |\ - sed "s/Fullscreen/f/;s/Window/w/;s/Region/c/;s/copy file/f/;s/copy link/l/;s/, //" | xargs "s" diff --git a/dot_local/bin/executable_shorten-clipb b/dot_local/bin/executable_shorten-clipb deleted file mode 100644 index c17abab..0000000 --- a/dot_local/bin/executable_shorten-clipb +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -curl -F"shorten=$(xclip -o)" -Fsecret= https://0.vern.cc/ | xclip -sel clipb diff --git a/dot_local/bin/executable_wal b/dot_local/bin/executable_wal deleted file mode 100644 index 628f81f..0000000 --- a/dot_local/bin/executable_wal +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -WALLPAPER_DIR="$HOME/media/wallpapers" - -case $1 in - r) - find $WALLPAPER_DIR -iname "*.jpg" | shuf -n 1 | xargs xwallpaper --stretch - ;; - *) - echo "Usage info:" - ;; -esac - diff --git a/dot_local/bin/executable_xb b/dot_local/bin/executable_xb deleted file mode 100644 index c83e670..0000000 --- a/dot_local/bin/executable_xb +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -case $1 in - install | i | add) - sudo xbps-install ${@:2} - ;; - remove | r | del | delete) - sudo xbps-remove ${@:2} - ;; - query | q | search | s) - sudo xbps-query ${@:2} - ;; - upgrade | u) - sudo xbps-install -Su - ;; - locate | l | find | f) - xlocate ${@:2} - ;; - *) - echo "Usage info:" - echo - echo "xb i - Calls 'sudo xbps-install' with the following arguments" - echo "xb q - Calls 'sudo xbps-query' with the following arguments" - echo "xb r - Calls 'sudo xbps-remove' with the following arguments" - echo "xb u - Upgrades the system packages with 'sudo xbps-install -Su'" - echo "xb l - Pass following arguments to xlocate" - echo "xb h - Displays help" - ;; -esac |