removing breaking section from disp and retab shime, yt
This commit is contained in:
parent
1abf6914e9
commit
a2055f3deb
10
scripts/disp
10
scripts/disp
|
@ -4,16 +4,6 @@ exists() {
|
|||
xrandr | grep ' connected' | grep "${1}" | wc -l
|
||||
}
|
||||
|
||||
# commands
|
||||
|
||||
[ "$1" = "big" ] && \
|
||||
xrandr --output LVDS1 --off && \
|
||||
exit 0 || exit 1
|
||||
|
||||
[ "$1" = "small" ] && \
|
||||
xrandr --output HDMI2 --off && \
|
||||
exit 0 || exit 1
|
||||
|
||||
# usual setup: thinkpad x220 on dock connected to external
|
||||
# monitor
|
||||
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
#!/bin/sh
|
||||
|
||||
case $0 in
|
||||
*"timer"*)
|
||||
[ $# -ne 2 ] && printf "specify minutes and \
|
||||
seconds\n" && exit 1
|
||||
sleep $(($1 * 60 + $2))
|
||||
printf "your timer is done\a\n"
|
||||
exit 0
|
||||
;;
|
||||
*"alarm"*)
|
||||
[ $# -ne 1 ] && printf "specify time\n" && exit 1
|
||||
ttw=$(($(date +%s --date="$1 tomorrow") - $(date +%s)))
|
||||
sleep $ttw
|
||||
printf "your alarm is done\a\n"
|
||||
exit 0
|
||||
;;
|
||||
*"timer"*)
|
||||
[ $# -ne 2 ] && printf "specify minutes and \
|
||||
seconds\n" && exit 1
|
||||
sleep $(($1 * 60 + $2))
|
||||
printf "your timer is done\a\n"
|
||||
exit 0
|
||||
;;
|
||||
*"alarm"*)
|
||||
[ $# -ne 1 ] && printf "specify time\n" && exit 1
|
||||
ttw=$(($(date +%s --date="$1 tomorrow") - $(date +%s)))
|
||||
sleep $ttw
|
||||
printf "your alarm is done\a\n"
|
||||
exit 0
|
||||
;;
|
||||
*"tomato"*)
|
||||
[ $# -ne 2 ] && \
|
||||
printf "specify work and rest time\n" && exit 1
|
||||
counter=0
|
||||
while true; do
|
||||
printf "start work cycle %s\a\n" $(($counter + 1))
|
||||
sleep $(($1 * 60))
|
||||
printf "start rest cycle %s\a\n" $(($counter + 1))
|
||||
sleep $(($2 * 60))
|
||||
counter=$(($counter + 1))
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
*"stopwatch"*)
|
||||
now=$(date +%s)
|
||||
read var
|
||||
printf "%s\n" $(($(date +%s) - $now))
|
||||
exit 0
|
||||
;;
|
||||
*"verbosewatch"*)
|
||||
min=0
|
||||
sec=0
|
||||
while true; do
|
||||
printf "%02d:%02d\r" $min $sec
|
||||
sleep 1
|
||||
sec=$(($sec + 1))
|
||||
[ $sec -eq 60 ] && min=$(($min + 1)) && sec=0
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
printf "unknown invocation\n"
|
||||
exit 2
|
||||
;;
|
||||
[ $# -ne 2 ] && \
|
||||
printf "specify work and rest time\n" && exit 1
|
||||
counter=0
|
||||
while true; do
|
||||
printf "start work cycle %s\a\n" $(($counter + 1))
|
||||
sleep $(($1 * 60))
|
||||
printf "start rest cycle %s\a\n" $(($counter + 1))
|
||||
sleep $(($2 * 60))
|
||||
counter=$(($counter + 1))
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
*"stopwatch"*)
|
||||
now=$(date +%s)
|
||||
read var
|
||||
printf "%s\n" $(($(date +%s) - $now))
|
||||
exit 0
|
||||
;;
|
||||
*"verbosewatch"*)
|
||||
min=0
|
||||
sec=0
|
||||
while true; do
|
||||
printf "%02d:%02d\r" $min $sec
|
||||
sleep 1
|
||||
sec=$(($sec + 1))
|
||||
[ $sec -eq 60 ] && min=$(($min + 1)) && sec=0
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
printf "unknown invocation\n"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
|
62
scripts/yt
62
scripts/yt
|
@ -23,44 +23,44 @@ see yt(1) for more information on usage
|
|||
"
|
||||
}
|
||||
sync () {
|
||||
for i in $(cat $YT_DATFILE | tr '\n' ' '); do
|
||||
torify curl -s \
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=$i\
|
||||
> ${YT_CACHEDIR}/$i
|
||||
done
|
||||
for i in $(cat $YT_DATFILE | tr '\n' ' '); do
|
||||
torify curl -s \
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=$i\
|
||||
> ${YT_CACHEDIR}/$i
|
||||
done
|
||||
}
|
||||
display () {
|
||||
tmp1=$(mktemp)
|
||||
tmp2=$(mktemp)
|
||||
for i in $(ls $YT_CACHEDIR | tr '\n' ' '); do
|
||||
grep \<media:title\> ${YT_CACHEDIR}/$i | cut -c 17- | \
|
||||
rev | cut -c 15- | rev >> $tmp1
|
||||
grep 'link rel' ${YT_CACHEDIR}/$i | grep 'watch' | \
|
||||
cut -c31- | rev | cut -c4- | rev >> $tmp2
|
||||
done
|
||||
cat $tmp1 $tmp2 | pr -2t -s" | "
|
||||
tmp1=$(mktemp)
|
||||
tmp2=$(mktemp)
|
||||
for i in $(ls $YT_CACHEDIR | tr '\n' ' '); do
|
||||
grep \<media:title\> ${YT_CACHEDIR}/$i | cut -c 17- | \
|
||||
rev | cut -c 15- | rev >> $tmp1
|
||||
grep 'link rel' ${YT_CACHEDIR}/$i | grep 'watch' | \
|
||||
cut -c31- | rev | cut -c4- | rev >> $tmp2
|
||||
done
|
||||
cat $tmp1 $tmp2 | pr -2t -s" | "
|
||||
}
|
||||
add () { # $1: name of channel id
|
||||
printf "%s\n" $1 >> $DATFILE
|
||||
printf "%s\n" $1 >> $DATFILE
|
||||
}
|
||||
del () { # $1: line number of channel id
|
||||
sed -i "${1}d" $DATFILE
|
||||
sed -i "${1}d" $DATFILE
|
||||
}
|
||||
case $1 in
|
||||
*"s"*)
|
||||
sync
|
||||
;;
|
||||
*"a"*)
|
||||
[ $# -eq 2 ] && add $2
|
||||
;;
|
||||
*"d"*)
|
||||
[ $# -eq 2 ] && del $2
|
||||
;;
|
||||
*"h"*)
|
||||
info
|
||||
;;
|
||||
*)
|
||||
display
|
||||
;;
|
||||
*"s"*)
|
||||
sync
|
||||
;;
|
||||
*"a"*)
|
||||
[ $# -eq 2 ] && add $2
|
||||
;;
|
||||
*"d"*)
|
||||
[ $# -eq 2 ] && del $2
|
||||
;;
|
||||
*"h"*)
|
||||
info
|
||||
;;
|
||||
*)
|
||||
display
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue