From 5954eaebfd1f7168a8354c7d6ae95d67c33504df Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 21 Mar 2024 13:48:01 -0700 Subject: [PATCH] remove `sc` because i never use it --- sh/sc | 71 ------------------------------------------------------- sh/scropt | 4 ---- 2 files changed, 75 deletions(-) delete mode 100755 sh/sc diff --git a/sh/sc b/sh/sc deleted file mode 100755 index 14ea8e2..0000000 --- a/sh/sc +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash -# NO_ZSH -# YES_BASH -# NO_DASH -# NO_ASH - -sc_shorten() { - REPLY="${1:2:2}${1:5:2}${1:8:2}${1:11:12}" -} - -# http://stackoverflow.com/a/10797966 -uri_encode() { - REPLY="$(echo -En "$@" | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "")" - REPLY="${REPLY:2}" -} - -copy_scr() { - local fn="$1" - local short="$(basename $fn)" - local r='20\d\d-\d\d-\d\d_\d\d\d\d\d\d\d\d.(png|jpg)' - grep -Pq "$r" <<<"$short" || return 1 - - ea put "$fn" "$short" - sc_shorten "$short" - uri_encode "$REPLY" - REPLY="$EA_DOMAIN/s/$REPLY" - return 0 -} - -copy_tmp() { - local fn="$1" - local short="$(basename "$fn")" - - ea put "$fn" "$short" - uri_encode "$short" - REPLY="$EA_DOMAIN/t/$REPLY" - return 0 -} - -sc() { ### @- - ### upload given files to a webserver and return a direct link for sharing them. - ### you'll want to tweak this if you use it yourself. - ### this contains some extra logic for screenshots created by `scropt`. - ### - ### **TODO:** consider renaming because sc(1) already exists. - if [ -n "${ZSH_VERSION:-}" ]; then - # syntax is too different to bother tbh - echo "please run with bash" - return 1 - fi - which xsel &>/dev/null || { - echo "please install xsel" - return 1 - } - - local clipboard="" f= - for f; do - f="$(readlink -f "$f")" - if [ ! -e "$f" ]; then - continue - fi - copy_scr "$f" || copy_tmp "$f" - clipboard="$clipboard"$'\n'"$REPLY" - done - xsel -b <<<"${clipboard:1}" - return 0 -} - -[ -n "${preload+-}" ] || . ~/sh/preload || exit 2 -eval ${preload:-preload} ea -[ -n "${preload+-}" ] || sc "$@" diff --git a/sh/scropt b/sh/scropt index 8f8e749..4c9068f 100755 --- a/sh/scropt +++ b/sh/scropt @@ -6,10 +6,6 @@ scropt() { ### @- ### run `scrot` through `optipng` and save the result to `~/play/$(now).png`. - ### - ### ``` - ### $ ~/sh/sc $(~/sh/scropt -s -d0.5) - ### ``` local now= fn= now="$(now)" || return fn="$HOME/play/$now.png"