summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothedev <grothedev@gmail.com>2021-11-14 12:55:29 -0500
committergrothedev <grothedev@gmail.com>2021-11-14 12:55:29 -0500
commit5fa7f35a6b52301cc02c85e8383c9e61e379d351 (patch)
tree38fc428528deadddbcb82048b38b69a6fb5afc7d
parent9567428e99acb1689ddfe2a6ffba8a675cbafa93 (diff)
updated pull_thoughts script. added support for i3 DM in wallpaper_change.
-rwxr-xr-xbig4
-rwxr-xr-xpull_thoughts75
-rwxr-xr-xsfm5
-rwxr-xr-xwallpaper_change13
4 files changed, 67 insertions, 30 deletions
diff --git a/big b/big
index 21d275e..0a24436 100755
--- a/big
+++ b/big
@@ -1,6 +1,6 @@
if [ -z ${2} ]; then
- du -ah ${1} | sort -n -r | head -n 15
+ du -a ${1} | sort -n -r | head -n 15
else
- du -ah ${1} | sort -n -r | head -n ${2}
+ du -a ${1} | sort -n -r | head -n ${2}
fi
diff --git a/pull_thoughts b/pull_thoughts
index 10c481d..de81c2f 100755
--- a/pull_thoughts
+++ b/pull_thoughts
@@ -1,32 +1,59 @@
#
#TODO update
-tdir="/srv/www/thesite/public/t/"
-if [[ -z ~/t.remote/ ]]; then mkdir ~/t.remote; fi
-echo "remote text files:"
-ssh hb "ls ${tdir}"
-scp -r hb:${tdir}/ ~/t.remote/
-for f in `ls ~/t.remote/`; do
- echo "checking "${f}
- if [ -e ~/${f} ]; then
- fog=~/${f}
- elif [ -e ~/doc/${f} ]; then
- fog=~/doc/${f}
+#this is where the notes are stored on server
+tdir="/srv/www/thesite/public/t/" #t for 'text' i guess
+
+buffer=${HOME}"/.tmp/tbuff/" #buffer dir to temporarily store the downloaded files
+
+DBG=0
+if [[ $1 ]]; then DBG=1; fi
+
+#store the notes in a temporary buffer
+if [[ ! -d $buffer ]]; then mkdir -p $buffer; fi
+
+filelist=`ssh hb "ls ${tdir}"`
+if [[ $filelist == "" ]]; then
+ echo "no new notes from server. will check local buffer"
+else
+ scp -r hb:${tdir}/* $buffer"/"
+fi
+
+if [[ $DBG ]]; then
+ echo "remote text files:"
+ echo $filelist
+fi
+
+if [[ -z `ls $buffer` ]]; then
+ echo "nothing in buffer. exiting."
+ exit 0
+fi
+
+for f in `ls $buffer`; do
+ if [[ $DBG ]]; then
+ echo "checking "${f}
fi
- echo "backing up "${fog}
- cp ${fog} ${fog}.prev
-
- echo "prepending new data"
- cat ~/t.remote/${f} > ${fog}
- echo "" >> ${fog}
- cat ${fog}.prev >> ${fog}
-
- echo "deleting file from server"
- d=`date +%s`
- ssh hb "tar -czvf ~/.t.bak/${d}.tar.gz ${tdir}/*; rm ${tdir}/*"
- rm ~/t.remote/${f}
- rm ${fog}".prev"
+ #check if a file of the same name already exists locally.
+ #if so, prepend new note to it. NOTE: change to append if more practical
+ if [ -e ~/doc/${f} ]; then
+ fog=~/doc/${f}
+
+ if [[ $DBG ]]; then echo "backing up "${fog}; fi
+ cp ${fog} ${fog}.prev
+ if [[ $DBG ]]; then echo "prepending new data"; fi
+ cat ${buffer}/${f} > ${fog}
+ echo "" >> ${fog}
+ cat ${fog}.prev >> ${fog}
+ rm ${fog}".prev"
+ else
+ cat ${buffer}/${f} > ~/doc/${f}
+ fi
+ rm ${buffer}/${f}
#ssh hb "echo '' >> ${f}.bak; cat ${fog} >> ${f}.bak; rm ${f}; touch ${f}; chmod a+w ${f}; sudo chown www-data:www-data ${f}"
done
+#backup remote files
+d=`date +%s`
+ssh hb "cd ${tdir}/..; tar -czvf .t.bak/${d}.tar.gz ${tdir}/*; rm ${tdir}/*"
+
#TODO delete old backups
#ssh hb "if [[ $((`find ~/.t.bak/ -type f | wc -l`)) -gt 5 ]]; then fi"
diff --git a/sfm b/sfm
index d7ff738..bb5eb19 100755
--- a/sfm
+++ b/sfm
@@ -42,8 +42,11 @@ case ${1} in
station="thetrip.pls";;
7)
station="seventies.pls";;
+ th)
+ station="thistle.pls";;
*)
station="${1}.pls";;
esac
-cvlc -I lua https://somafm.com/${station}
+#cvlc -I lua https://somafm.com/${station}
+vlc -I lua https://somafm.com/${station}
diff --git a/wallpaper_change b/wallpaper_change
index 2ce1d99..4298116 100755
--- a/wallpaper_change
+++ b/wallpaper_change
@@ -1,8 +1,15 @@
n=`ls -f ~/img/wallpapers | wc -l`
-echo "$n"
i=`shuf -i 0-$n -n 1`
files=(~/img/wallpapers/*)
export DISPLAY=":0.0"
-`nitrogen --head=0 --set-scaled ${files[i]}`
+if [[ $DESKTOP_SESSION == "i3" ]]; then
+ feh --bg-scale --zoom fill ${files[i]}
+else
+ `nitrogen --head=0 --set-scaled ${files[i]}`
+fi
i=`shuf -i 0-$n -n 1`
-`nitrogen --head=1 --set-scaled ${files[i]}`
+if [[ $DESKTOP_SESSION == "i3" ]]; then
+ feh --bg-scale --zoom fill ${files[i]}
+else
+ `nitrogen --head=1 --set-scaled ${files[i]}`
+fi