Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

← Activating All My Registered Domains
Bopping Between Python & Bash Scripts No Biggie →

Bash Script Loading External Files

by Mike Levin

Sunday, May 01, 2022

Surprise again! All this content is moved over to MikeLevinSEO.com, where it really belongs. I’m going to keep Pythonic Ally “free” for better posts. I’ll probably keep FizzBuzz and things like that over there. But I’ll definitely be moving things around a bit until they find their natural home amongst my sites.

I put all 15 of my registered domains that I keep for aspirational reasons and for walking the walk if you’re going to talk the talk SEO reasons. But it broke my release system. I’m taking it as an opportunity to simplify the system. `

I’ve put the release system as the last of my vim buffers. So that means I type:

:blast

…to get to it. It used to be called “gall.sh” which I liked because it was a play on my “all.sh” file (for editing all) but I had the gall to publish them all. As much as I liked that helper-file name, I ended up chaging it to “blast.sh” because it has even better double entendre meaning.

So blast.sh is the release system that’s actually broken right now.

Okay, and now it’s fixed. It’s much better than before:

#    _     _           _
#  _| |__ | | __ _ ___| |_
# (_) '_ \| |/ _` / __| __|
#  _| |_) | | (_| \__ \ |_
# (_)_.__/|_|\__,_|___/\__|

clear
figlet :blast

filename='./helpers/sites.txt'
n=1
while read line; do
echo "$n $line"
n=$((n+1))
done < $filename

echo ""
cd /mnt/c/Users/mikle/github

figlet Deleting Old Files... -w 120
n=1
while read line; do
rm ./$line/_posts/*
n=$((n+1))
done < $filename

cd blogslicer
nbdev_clean_nbs
nbdev_build_lib
git commit -am "Updating all"
git push

figlet Slicing Blogs...
filename='../helpers/sites.txt'
n=1
while read line; do
python blogslicer/core.py -a "Mike Levin" -p "../$line" -t "$line Blog" -s "blog"
n=$((n+1))
done < $filename

cd ..

figlet helpers
cd helpers
git commit -am "Updating all"
git push
cd ..

figlet vim
cp ~/.vimrc ./vim/
cd ./vim
git commit -am "Updating all"
git push
cd ..

figlet journal
cd journal
git commit -am "Updating all"
git push
cd ..

figlet mlseo -w 120
cd mlseo
jupyter nbconvert --to markdown index.ipynb
sed -i -e '1,5d' index.md
mv index.md ./docs
git add ./docs/*
git commit -am "Updating all"
git push
cd ..

figlet Publishing Sites... -w120
filename='./helpers/sites.txt'
n=1
while read line; do
figlet $line -w 120
cd $line
git add _includes/*
git add _posts/*
git commit -am "Updating all"
git push
cd ..
n=$((n+1))
done < $filename

figlet Done!

echo "Press any key to continue"
while [ true ] ; do
read -t 10 -n 1
if [ $? = 0 ] ; then
exit ;
else
echo "waiting for the keypress"
fi
done
exit