Shell Tricks: Better Bash debug
Toss the following snippet at the top of any Bash script and run with
DEBUG=1
to automatically activate set -x
and print its output via $PS4
.
Micropub
I saw Micropub in iA Writer’s publish settings today and had never heard of it. tl;dr I think I can use it and a small Heroku app to publish to this site from iA Writer on my phone 🤔
Updated permalinks
Updated my permalinks. No one cares, but I wanted to mention it so I remember when I did it 😀
Obsidian Nirvana
I really need to do a proper project/post on my Obsidian setup, but I think I’ve finally reached planning nirvana.
Simple PHP/SMTP mail script
I needed a quick ‘n dirty script to test outgoing SMTP email via PHP and found php-smtp.
Pure bash markdown table generator
I wanted a portable markdown table generator a few months back and threw
together markdown-table
.
Merging git repos with git-filter-repo
I needed to merge multiple git repos into a single one using subdirectories,
while preserving the history. I have used git filter-branch
in the past
to do the inverse. Searching around, I found git-filter-repo which made
it a snap.
Dump Calendar.app events to JSON
I wanted a way to dump Calendar.app events to JSON. I came across icalBuddy, which can dump your events to text. I threw together the following bash/jq script to convert icalBuddy output to JSON.
Shell Tricks: Pretty Printing the name of your program
You might need to print or use the name of your program itself — what you
would see if you ran basename my-script.sh
. tl;dr: use ${0##*/}
.
Shell Tricks: Detecting if your script is being piped
If you need to check if a shell script is being piped to another program (i.e.
bash yourscript.sh | less
) you can use test -t 1
and friends.