duckland.org

TUI Challenge: Day 3

Day 3 of the TUI Challenge is about browsing the web in the terminal.

I use to use browsers like lynx or elinks back in the early days of the web when I had a slow connection like dial-up or a wireless modem from the late 1990’s. Back then, web sites were much simpler than today. An advance web site might have tables! So, in those days, a text browser worked well. But, how about now in the era of Web 2.0 or even Web 3.0?

The challenge today is to use a text browser to visit two web sites and summarize them. And then, things got hard.

I was actually trying to use lynx for my daily web usage, and I was looking up how to configure newsboat so I can forward an article via email now and later to add to my task tracker.

The two sites I that I was trying to find the answer on I was trying to look at was reddit and github which gave problems. I think the ’new’ Reddit has a lot of JavaScript which these two text browsers do not support. My solution was to use old.reddit.com which is the classical interface which is closer to Web 1.0.

GitHub was all but useless in my text browsers. It was too hard to get past all the items normally hidden behind js menus. And, after a few page views, it stopped showing me anything from the repos I was trying to visit. I am not sure if the site thought I was an AI scraper and just stopped showing me anything or if there was something else.

In the end, I was able to use old Reddit, Google Groups, and the newsboat web site to figure out what I wanted to do:

bind m article,articlelist pipe-to "neomutt -s\"RSS Article\" me@example.com" -- "Email article"

Daily totals

Score time! Yesterday left us with 55 points. The challenge of doing research on at least two site and summarizing it is worth 20 points. In the bonus points include 5 for filling out a form which I did many times on my search engine page, which gives me 25 points for the day, and a running total of 80 points.

TUI Challenge: Day 2

Hey, look! Another day, another post. Today’s challenge is Email Management. Since I already live in neomutt, I should probably describe my setup.

Receiving Email and filtering

Much to my shame, I am still receiving my email with Gmail. But, it is on my list to migrate somewhere else this year. I think I have narrowed it down to two providers, but that is not what I am doing today.

I do have IMAP enabled on my account so I can read my email without going to gmail.com. For filtering, I use a tool called gmailctl which allows me to control gmail’s filters from my computer. It works by connecting to gmail and pulling down the filter definition file, and then firing up my default editor. Once I am happy with the changes, it will upload it back to gmail.

To actually retrieve my emails, I use mbsync which is part of the isync suite. You follow the directions, and it will sync your email down. This tool will work with any IMAP server, so when I finally leave gmail, it will still work. One of the nice things is that since it is written in python, you can re-map folder (labels in gmail-speak) to something different locally. For example, I map All Mail on google’s side to All-Mail on my side.

I use a systemd timer to schedule the sync runs.

I also run notmuch to index my mail so I can search it in my MUA (Mail User Agent) of choice.

Reading Email

I have been using mainly a TUI to read my email since I started on the internet. Back in the beginning, it was because there where no GUI email applications, and it was before the WWW (yes, I am that old). Over the years, I have used elm (fun fact, for a while, I was the Debian package maintainer for elm!), pine, and an Emacs email client (do not remember the name anymore). But the client I have been using since I started using back when it was new is mutt, although I have switched to neomutt a while back. Neomutt is mutt with a bunch of patches included, but it is a great MUA on its own.

One of the killer features (for me, anyway) is that I can configure neomutt to use notmuch and it makes searching for a specific email a breeze.

For my address book, I use a program called khard which I sync with my google address book using vdirsyncer which I will talk more about on Day 6.

Sending Email

I used to use gmail’s SMTP service, but sometime this year, the have changed their sending limits to an aggressively low number which would cause me to not to be able to send an email for hours, sometimes days. I typically do not send a lot of emails (mainly less than 10 automated reports to myself a day), so this was annoying. I switched to using the free tier at smtp2go and I have had zero issues sending email since then. My needs to not really require any of their paid plans, but I am thinking about getting the smallest paid plan to help support the service.

Daily totals

I come into today with 20 points. How did I do today? Well, the basic for setting up an email tui is 20 points, 5 points for filtering, and 10 points for using a TUI address book for a daily total of 35, bring my total to 55 points!

TUI Challenge: Day 1

tap, tap Is this thing on? When was the last time I published anything? Oh, back on January 15, 2024. Oops.

Well, I had to clean up a few things to get this back working with updates to hugo, the static blogging engine I use for the site.

So, what prompted me to fire this up again, and actually make it work (unlike the last few times I was going to start this)?
Well, I listen to a bunch of podcasts from Jupiter Broadcasting, including one called Linux Unplugged, and they are running a 7 day TUI Challenge. Now, since I normally read my email and RSS feeds in a TUI app, and I use VIM as my editor and IDE, I figured it would be fairly easy for me to take part.

The two big things I use a GUI for are web browsing with qutebrowser and watch youtube vids with MPV, I should be able to adapt.

Anyway, Day 1 challenge is to write document using a TUI editor of at least 200 words. There are bonus points for using scripts to help things out, and I guess the script I use to start editing a file should work:

#!/usr/bin/env bash
#===============================================================================
#
#          FILE: dopost
# 
#         USAGE: ./dopost
# 
#   DESCRIPTION: make a new post for hugo
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Don Harper (), duck@duckland.org
#  ORGANIZATION: 
#       CREATED: 02/02/2019 08:35:34 PM CDT
#      REVISION: Based off of genpost.sh
#===============================================================================

set -o nounset                              # Treat unset variables as an error
trap onexit 1 2 3 15 ERR EXIT
#--- onexit() -----------------------------------------------------
#  @param $1 integer  (optional) Exit status.  If not set, use `$?'

function onexit() {
	local exit_status=${1:-$?}
	if [ "${exit_status}" == 0 ]
	then
		exit
	fi
	notify-send "Exiting ${myname} with $exit_status"
	cd
	exit "${exit_status}"
}

myname="$(basename ${0} .sh)"
Title="untitled"
Category="none"
TAGS="tagless"

while getopts "t:T:c:h" OPTIONS
do
	case ${OPTIONS} in
		t) Title="$OPTARG" ;;
		c) Category="$OPTARG" ;;
		T) TAGS="$OPTARG" ;;
		*)
			echo "$0 -t '<title>' -c '<category>' [-T '<tags[,tags2]>']"
			exit 1
			;;
	esac
done
shift

if [ "${Title}" == "untitled" ]
then
	echo "Missing title"
	echo "$0 -t '<title>' -c '<category>' [-T '<tags[ tags2]>']"
	exit 1
fi
if [ "${Category}" == "none" ]
then
	echo "Missing category"
	echo "$0 -t '<title>' -c '<category>' [-T '<tags[ tags2]>']"
	exit 1
fi
if $(echo "${TAGS}" | grep -q ' ')
then
	TAGS=$(echo "${TAGS}" | sed 's/ /", "/g')
fi

BASE="${HOME}/src/WWW/sites/duckland.org"
DATE=$(date +%F)
YEAR=$(echo $DATE | awk -F- '{print $1}')
MON=$(echo $DATE | awk -F- '{print $2}')
Name=$(echo ${Title} | sed -e 's/^ //' -e 's/,//' -e 's/ ://' -e 's/ /-/g' -e 's/\?//' -e 's/\!//' | tr '[A-Z]' '[a-z]' )
cd ${BASE} 
git co draft
printf "title - %s\nname - %s\n" "$Title" "$Name"
OUTPUTDIR="${BASE}/content/posts/${YEAR}/${MON}/"
mkdir -p ${OUTPUTDIR}
OUTPUT="${OUTPUTDIR}/${Name}.md"
echo "---" > ${OUTPUT}
echo "date: \"${DATE}T04:00:00-07:00\"" >> ${OUTPUT}
echo "title: \"${Title}\"" >> ${OUTPUT}
echo "tags: [\"${TAGS}\"]" >> ${OUTPUT}
echo "categories: [\"${Category}\"]" >> ${OUTPUT}
echo "#image: \"\"" >> ${OUTPUT}
echo "#series: [\"\"]" >> ${OUTPUT}
echo "summary: \"\"" >> ${OUTPUT}
echo "Victor_Hugo: \"true\"" >> ${OUTPUT}
echo "Focus_Keyword: \"\"" >> ${OUTPUT}
echo "---" >> ${OUTPUT}
echo "" >> ${OUTPUT}
#cd ~/src/www.duckland.org
#tmux neww -n "New Post" -t 30 "cd ~/src/www.duckland.org ; hugo serve -D -F"
#tmux split-window -h "${EDITOR} ${OUTPUT}"
#tmux select-layout main-vertical

#. ~/.myapps
#$TERMPROG -e tmuxp load duckland
tmuxinator start duckland

As the TUI Challenge has a scoring system, I am claiming 10 points for editing a file under vim, and an additional 10 points as my script does a bit of formating, for a total of 20 points.