bash: TOTP From the Terminal With oathtool

TOTP is Time-based One Time Password. Most people use applications on their phone for TOTP, such as andOTP, Google Authenticator, and related apps. But, as we move from using a phone as a second factor for what we are doing on a computer to a phone being the primary way we interact with the Internet, it makes sense to make the computer the second factor. This is the idea behind this script. It is based on analyth’s script, except I stripped out the I/O.


# Assign variables
google=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)
wordpress=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)
amazon=$(oathtool --base32 --totp "YOUR SECRET KEY" -d 6)

# Print variables
echo "google: ${google} | wordpress: ${wordpress} | amazon: ${amazon}"

This will print:

google: 123456 | wordpress: 123456 | amazon: 123456

However, I didn’t like the idea of my one time password codes only being protected by normal file protections on a Linux system. I thought it should be encrypted with gpg. So, I saved it to a file in my scripts directory, totp, and encrypted it with my public key. If you don’t have a gpg key pair, instructions are available online.

$ gpg -r -e ~/pathto/totp

Then, to run the shell script, do:

$ gpg -d ~/pathto/totp.gpg 2>/dev/null | bash

This will prompt you for your gpg password and then run this script. You likely won’t want to remember this string of commands, so you could make your life easier by adding it as an alias under .bash_aliases

alias totp='gpg -d ~/pathto/totp.gpg 2>/dev/null | bash'


Newsboat is the Mutt of RSS readers. Works and looks pretty much the same as mutt. In making the conversion, I learned that I have over 500 RSS feeds, which in combination with a few dozen newsletters via email is how I discover the material to post to this blog.

I used to use an app on my phone to scroll through when I had time, but I found using Newsboat sped up the process considerably. So, even though I have to sit down at the computer and go through each feed, Newsboat will be my default method moving forward. Recommended.

bash: Cryptocurrency Prices From the Linux Terminal

printf -v coin '%s' -1   # bitcoin

price() {
  # A function that pulls cryptocurrency price data from coingecko
  curl -X 'GET' ''"$1"'&vs_currencies=usd' \
     -H 'accept: application/json' 2> /dev/null | # sends download data to /dev/null
  sed  's/.*usd"://' |   # Removes everything before the price
  sed 's/..$//' |        # Removes back two }}
  sed 's/^/\$/'          # Adds dollar sign to the front, returns

price=$(price $1) # calls function with command line variable
bitcoin=$(price bitcoin)
ethereum=$(price ethereum)

# Checks to see if there is a command line variable and prints to console
if [[ -z $1 ]]; then
    echo "bitcoin: ${bitcoin} | ethereum: ${ethereum}"
    echo "${1}: ${price} | bitcoin: ${bitcoin} | ethereum: ${ethereum}"

h/t Techstructive for the basic idea. I simplified their code by cutting out the I/O and putting the coin as a variable when calling the script, e.g. bitcoin, and formatting it by piping it through sed. Have I mentioned how much I love sed?

Edit: Modified this on August 12, 2021 so it is now a function and prints a portfolio of coins. I track two or three, and it was getting annoying to have to do them each individually. All you need to do to modify it for the coins you are interested in is create a new function call:

cardano=$(price cardano)

Then add that to both the if and then print results.

    echo "${1}: ${price} | bitcoin: ${bitcoin} | ethereum: ${ethereum} | cardano: ${cardano}"

Interactive Fiction: ink & inklewriter, et al.

“* inklewriter is an easy-to-use online tool to write basic interactive stories.

* ink by comparison is a more powerful narrative scripting language that is primarily designed for professional game development, though it can also be used to write and share choice-based interactive fiction. It is also surprisingly easy to learn, though for ease of use it’s hard to beat inklewriter!

h/t to Interconnected and the post “Filtered for some text-based virtual realities.” I could have easily made posts for

The whole post is gold for anyone interested in what’s going on and the tools in current use with the interactive fiction community. My knowledge of the tools stopped at Inform 7.

Being a Creator, Craig Mod

This is a really interesting discussion of how one man created a business using a subscription model combined with discounts for the finished work for subscribers. There’s much to think about in this discussion. If this is of any interest to you, I’d read the whole thing and the previous year’s as well. He talks about what it takes, how much it costs, the tools he uses, and provides a whole lot of other detail that might provide some food for thought.

e Foundation

“We build desirable, open source, privacy-enabled smartphone operating systems.

e Foundation is a recent fork of LineageOS. It looks like it supports older devices, such as the t0lte device (aka Samsung Note 2) that I had to upgrade from when LineageOS stopped supporting when they rolled out Android 9, Pie. So, of course, I’ll be trying it in the next few months.

Minimal Physical Fitness Standard: Four Flights of Stairs in One Minute

“Climbing four flights of stairs in less than a minute indicates good heart health…”The stairs test is an easy way to check your heart health,” said study author Dr. Jesús Peteiro, a cardiologist at University Hospital A Coruña, Spain. “If it takes you more than one-and-a-half minutes to ascend four flights of stairs, your health is suboptimal, and it would be a good idea to consult a doctor.”

—Sophia Antipolis, “Test your heart health by climbing stairs.” EurekaAlert. December 11, 2020.