From c7ee3cac4974d7f0648f95ef426f35be70c2e770 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Sun, 1 May 2022 04:17:30 +0530 Subject: removing redundant scripts --- .scripts/mntwindows | 7 ---- .scripts/price | 50 ------------------------ .scripts/redeat | 108 ---------------------------------------------------- 3 files changed, 165 deletions(-) delete mode 100755 .scripts/mntwindows delete mode 100755 .scripts/price delete mode 100755 .scripts/redeat diff --git a/.scripts/mntwindows b/.scripts/mntwindows deleted file mode 100755 index 5adb9c5..0000000 --- a/.scripts/mntwindows +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -sudo mount /dev/nvme0n1p3 /home/C -sudo mount /dev/nvme0n1p4 /home/D -sudo mount /dev/nvme0n1p5 /home/E -sudo mount /dev/nvme0n1p6 /home/F -sudo mount /dev/nvme0n1p7 /home/G diff --git a/.scripts/price b/.scripts/price deleted file mode 100755 index 42c84c1..0000000 --- a/.scripts/price +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# Usage: -# price -# price bat "Basic Attention Token" 🦁 -# When the name of the currency is multi-word, put it in quotes. - -[ -z "$3" ] && exit 1 - -# use $4 as currency, if not passed in use "usd" as default -currency="${4:-usd}" -interval="@14d" # History contained in chart preceded by '@' (7d = 7 days) -dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" -pricefile="$dir/$1-$currency" -chartfile="$dir/$1-$currency-chart" - -updateprice() { temp="$(mktemp)" - curl -s "$currency.rate.sx/1$1" > "$temp" && - mv -f "$temp" "$pricefile" && - curl -s "$currency.rate.sx/$1$interval" > "$temp" && - mv -f "$temp" "$chartfile" ;} - -[ -d "$dir" ] || mkdir -p "$dir" - -[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - updateprice "$1" - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;; - 2) notify-send -u low "$3 Updating..." "Updating $2 price..." - updateprice "$1" && notify-send "$3 Update complete." "$2 price is now -\$$(cat "$pricefile")" ;; - 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" - notify-send "$3 $2 module" "\- Exact price: \$$(cat "$pricefile") -- Left click for chart of changes. -- Middle click to update. -- Shows 🔃 if updating prices. -- Last updated: - $uptime" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -case "$currency" in - usd) symb="$" ;; - gbp) symb="£" ;; - eur) symb="€" ;; - btc) symb="₿" ;; -esac - -printf "$3$symb%0.2f$after" "$(cat "$pricefile")" diff --git a/.scripts/redeat b/.scripts/redeat deleted file mode 100755 index e282131..0000000 --- a/.scripts/redeat +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -# Check if necessary programs are installed -for prog in dmenu jq sxiv; do - [ ! "$(which "$prog")" ] && echo "Please install $prog!" && exit 1 -done -# If notify-send is not installed, use echo as notifier -[ ! "$(which notify-send)" ] && notifier="echo" || notifier="notify-send" - -# args -while [ $# -gt 0 ]; do - case $1 in - -l|--limit) - shift - LIMIT=$1 - case $LIMIT in - ''|*[!0-9]*) - echo 'limit is NaN' - exit 1 - esac - shift - ;; - -f|--filter) - FILTER=1 - shift - ;; - -k|--keep) - KEEP=0 - shift - ;; - -v|--verbose) - VERBOSE=1 - shift - ;; - *) - subreddit=$1 - shift - ;; - esac -done - -# Default config directory -configdir="${XDG_CONFIG_HOME:-$HOME/.config}/redyt" - -# Create .config/redyt if it does not exist to prevent -# the program from not functioning properly -[ ! -d "$configdir" ] && echo "Directory $configdir does not exist, creating..." && mkdir -p "$configdir" - -# Default subreddit that will be inserted in "subreddit.txt" -# if it does not exist -defaultsub="linuxmemes" - -# If subreddit.txt does not exist, create it to prevent -# the program from not functioning properly -[ ! -f "$configdir/subreddit.txt" ] && echo "$defaultsub" >> "$configdir/subreddit.txt" - -# If no argument is passed -if [ -z "$subreddit" ]; then - # Ask the user to enter a subreddit - subreddit=$(dmenu -p "Select Subreddit r/" -i -l 10 < "$configdir/subreddit.txt" | awk -F "|" '{print $1}') - - # If no subreddit was chosen, exit - [ -z "$subreddit" ] && echo "no sub chosen" && exit 1 -fi - -# Default directory used to store the feed file and fetched images -cachedir="/tmp/redyt" - -# If cachedir does not exist, create it -if [ ! -d "$cachedir" ]; then - echo "$cachedir does not exist, creating..." - mkdir -p "$cachedir" -fi - -# Send a notification -[ $VERBOSE = 1 ] && $notifier "Redyt" "📩 Downloading your 🖼️ Memes" - -# Download the subreddit feed, containing only the -# first 100 entries (limit), and store it inside -# cachedir/tmp.json -curl -H "User-agent: 'your bot 0.1'" "https://www.reddit.com/r/$subreddit/hot.json?limit=${LIMIT:-100}" > "$cachedir/tmp.json" - -# Create a list of images -imgs=$(jq '.' < "$cachedir/tmp.json" | grep url_overridden_by_dest | grep -Eo "http(s|)://.*(jpg|png)\b" | sort -u) - -# If there are no images, exit -[ -z "$imgs" ] && $notifier "Redyt" "sadly, there are no images for subreddit $subreddit, please try again later!" && exit 1 - -# Download images to $cachedir -for img in $imgs; do - if [ ! -e "$cachedir/${img##*/}" ]; then - wget -P "$cachedir" $img - fi -done - -# Send a notification -[ $VERBOSE -eq 1 ] && $notifier "Redyt" "👍 Download Finished, Enjoy! 😊" -rm "$cachedir/tmp.json" - -# Display the images -if [ $FILTER = 1 ]; then - sxiv -a -o "$cachedir" -else - sxiv -a "$cachedir" -fi - -# Once finished, remove all of the cached images -[ ! $KEEP = 1 ] && rm "${cachedir:?}"/* -- cgit v1.2.3