various improvements
This commit is contained in:
@ -21,11 +21,11 @@ update() {
|
||||
[ -f "$lasttime" ] && read -r previoustime < "$lasttime" || previoustime=0
|
||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||
timedifference=$(( "$(date +'%s')" - "$previoustime" ))
|
||||
timedifference=$(( $(date +'%s') - previoustime ))
|
||||
|
||||
if [ "$timedifference" -gt 0 ]; then
|
||||
rx_avg=$(( "$rx" / "$timedifference" ))
|
||||
tx_avg=$(( "$tx" / "$timedifference" ))
|
||||
rx_avg=$(( rx / timedifference ))
|
||||
tx_avg=$(( tx / timedifference ))
|
||||
else
|
||||
rx_avg=$rx
|
||||
tx_avg=$tx
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#A script that launches documents in their respective viewers
|
||||
#either via dmenu or fzf depending on the context
|
||||
ppid () { ps -p ${1:-$$} -o ppid=; }
|
||||
|
@ -17,6 +17,6 @@ case "$(printf "mpv\\ncopy url\\nqueue download\\nqueue youtube-dl\\nbrowser\\nr
|
||||
#w3m) w3m "$1" >/dev/null 2>&1 ;;
|
||||
#"mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
|
||||
"rip media") dest="$(dmenuinput 'name of folder:')"
|
||||
lynx --dump --nonumbers --listonly "$1" | grep -E "(*\.webm|*\.mp4|\.gif|\.jpg|\.jpeg|\.png|\.pdf|\.epub|\.mobi|\.djvu)" | sort -u | xargs wget -P "$HOME/$dest"
|
||||
lynx --dump --nonumbers --listonly "$1" | grep -E "\.(webm|mp4|gif|jpg|jpeg|png|pdf|epub|mobi|djvu)" | sort -u | xargs wget -P "$HOME/$dest"
|
||||
notify-send "dmenuhandler" "all media ripped into $dest";;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user