Lifetime Bibliography

One of the things I wish I had done years ago was create a catalog of things I have read, viewed, or listened to. A bibliography of things I have digested over my lifetime. In order to mitigate that I am currently working on creating a catalog of my library. If you are old like me it brings up mental pictures of a large wooden cabinet with many an index card filed away. Well the one I am working on is electronic. My system is a simple bash script. I can run the script enter an ISBN number, the script goes out to the Internet, grabs the bibliographical information and insets into a Bibtex file.

What is a Bibtex file and why do I use it over something else?

First and foremost a Bibtex file is a structured plain text. I have been using computers since 1980 and programs have come and gone but plain text format is still here. Anything you want to keep for years and go back to should be plain text. I remember the days when Word Perfect had the market locked down and their format was the standard. Now Word Perfect is a small segment of the market and the file format they use now is not compatible with the format they used back in the day. Does anyone remember Lotus 123? Binary file formats come and go. So for data that you may want for twenty to forty years should be in a file format that is based on plain text.

Bibtex while an old file format is still used today by many of bibliography managers. Is it the best format? Maybe, maybe not but it is very convenient to use because so many tools can read it, including humans. It common use is the reason I chose the Bibtex file structure over something else. I could be replaced in the future. But even if it is, since the file is plain text it would only take a simple SED command or AWK script to put it in the right format. Off the soapbox.

Now to the script.

 #!/bin/bash
 str='https://www.ottobib.com/isbn/'
 str+=$1
 str+='/bibtex'
 xidel $str --extract //textarea >> ~/Documents/Latex/isbn.bib

The script is very simple the first part of the script creates an url. The url is for www.ottobib.com. You can provide the site with an ISBN and it will give you the bibliography entry for the matching ISBN in your requested format. The second part of the script uses xidel to extract the bibloigraphic information from the web page and appends it to my Bibtex file.

Please feel free to use at your own risk.

Zettelkasten ID bibliography-2020-05-20-1140

MPV as an Audiobook Player

To my dismay I can not find a terminal based audiobook reader. I can find plenty of music and even video players that are terminal based but nothing for audiobooks. I was talking to Roman, he is my black lab (think Mr. Peabody with black fur and without the glasses), about this and he suggested using one of the terminal players for music or videos. The problem is having a way to save your place in the audiobook

After much review we decided to use MPV. MPV has a switch --save-position-on-quit this allows you to resume playback where you left off if you quit the program and start it up later. The switch has one limitation it can only save the position for one file at a time. If you use that switch on the playback of multiple files it saves only the quit position for the last file played.

There are two switches I tried --use-filedir-conf which looks for file-specific configuration files in the same directory as the file being played. I tried this option first but I could not get it to be consistency applied. Sometimes it worked as intended and sometimes not. I am assuming the issue was me and not MPV. I may go back later and try to see if I can get this to work.

The second approach I tried was using the --config-dir=. This approach is the one that worked for me.

The first thing I did was create a directory in my current MPV config directory called book1. Next, I created a subdirectory in book1 called watch_later. This is the default directory that MPV will use to store the current stopping point. The new configuration file only has one line in it save-position-on-quit. This file is saved in book1 with the name mpv.conf Whenever this configuration is called it will save your position in watch_later.

Next I created a bash script the started MPV using the configuration file I just created. The script starts MPV with the specified configuration file and plays a playlist I created for the book called book1.m3u

 #!/bin/sh
 mpv --config-dir='/pathto.config/.config/mpv/book1' /pathtoplaylist/book1.m3u

If you listen to more than one book at a time, just repeat this setup for book2 and then for book3 till you get to the number of books you listen to simultaneously.

When you finish a book and want to start a new book just edit the book1 playlist and remove the old book and add the files for the new book.

This configuration allows me to start and stop playing my audio book and have MPV remember which file I left off at and where in that file I left off at.

Zettelkasten ID mpvaudiobook-2020-05-14-0744

Daily Driver

I wanted to write about the computer I use in my office day to day. It is Dell Optiplex 780 with a Core 2 Duo processor, 8 GB of ram, and a 1 TB hard drive. I bought the computer used from Dell after it came off lease. The computer was originally put into service in June of 2010. The only changes I have done to the computer is replacing the 160 GB hard drive with a 1 TB drive and upgrading the memory to 8 GB.

I use this machine every day. It is my daily driver. I have no real plans to replace it unless I find a deal I can't pass up. The machine works great and is very responsive.

How can I get by with a computer this old? My daily workflow is terminal based. Mutt for mail, khal for calendar, todoman for tasks, khard for contacts, newsboat for RSS, mpv for video, mpd for music, and vim for editing.

Do I use terminal based programs because they save an old computer from the trash heap. The answer is no. I find that terminal programs can increase my productivity. I am faster in Vim than in LibreOffice, I am faster on the command line than many graphical file utilities. It is quicker to have Newsboat download my daily reading, viewing, and listening than surf the net with a graphical browser.

Does this mean I do not use graphical programs? No, the web is a graphical place so yes I use a graphical browser when I am surfing looking for something, I use LibreOffice when I am doing a complicated spreadsheet, and I use GNUcash for my bookkeeping. I am saying terminal programs when appropriate can increase the speed at which you can work.

Is there more of a learning curve? Sometimes, but not always. Graphical programs have a steep learning curve if we actually learn the program. Graphical programs do have one sweet spot. If you don't really know anything about the program and just want to do the absolute rudimentary things in the program you can do that out of the box. The problem is often we a content with that and never go beyond that. To actually to be proficient in a program that takes study whether it be terminal based or graphically based.

Zettelkasten ID dailydriver-2020-05-13-1304

Zettelkasten IDs

They are many different opinions on how your zettelkasten ID could be structured. I think the one idea that everyone agrees on is that every zettelkasten ID should be unique. I use zettelkasten IDs for two things my actual zettelkasten notes and my blog posts. The ID structure for both is the same. I am able to differentiate between the two by file extensions.

Here is an example ID zettelkastenid-2020-05-12-2221 The first part of the ID is a simple word or combination of words to help me find that ID on the same day I create it for editing purposes. When I create a note I may want to go back in a hour or so and change it slightly. Using Vim's auto completion it is much easier to find the note that I worked on previously in the day with the alpha part of the ID. If I am searching for notes on a particular subject I will use FZF and Silver Search to search for tags or particular words or phrases. The second part of the ID is simply a time stamp of when the file was created. The format is year-month-date-time. I believe going down to the second will provide a unique enough number for a primary key. I inserted the hyphens to make the ID more readable. You certainly don't need the hyphens but it helps me see quickly when the note was originally created.

The zettelkasten ID is the same as the actual file name except for the file name includes an extension. For blog posts I use .md and for notes I use .markdown. This helps me to quickly differentiate between the two on the command line.

Again there are many ways to create a unique ID and I believe there are many right ways to do it. This is just the method that works for me.

Zettelkasten ID zettelkastenid-2020-05-12-2221

Vim Templates

I feature of Vim I recently came across was the use of templates. Templates can be used when creating new documents to automatically insert information that will be always included. Examples would be headers for blog posts, copyright notices, zettelkasten ids. Templates are based on file extenstions. So if the new document name ends in .html it uses the html template, if it ends in .md it uses the md template.

Templates are named skeleton.yourextension. So the html template is named skeleton.html. The md template is named skeleton.md. If I need multiple templates for particular file type, a work around I use is using different valid extensions for a that file type. I use markdown for three types of documents; dairy entries, zettelkasten notes, and blog posts. So in order to have three different templates, I use three different markdown extensions; for diary entries I use .mkd, for zettelkasten notes I use .markdown, and for blog posts I use .md. What if you want multiple templates for a given extension. The answer is I don't know. I would suggest looking for a Vim plugin.

Templates can be used for static or dynamic information. A good article to read about Vim templates is Use eval to create dynamic templates The article contains some great drop in place code to use dynamic & static templates. The addition of the code below to your .vimrc will allow you to use static or dynamic templates. The only bit that needs to be changed is the path to your templates.

augroup templates
  au!
  " read in template files
  autocmd BufNewFile *.* silent! execute '0r $HOME/vimfiles/templates/skeleton.'.expand("<afile>:e")

  " parse special text in the templates after the read
  autocmd BufNewFile * %substitute#\[:VIM_EVAL:\]\(.\{-\}\)\[:END_EVAL:\]#\=eval(submatch(1))#ge
augroup END

Here is an example template I use:

 ---
 Title: 
 Published: [:VIM_EVAL:]strftime('%Y-%m-%d %H:%M')[:END_EVAL:]
 Author: Rev. Fr. Robert Bower
 Tag: 
 layout: blog
 ---

 Zettelkasten ID  **[:VIM_EVAL:]expand("%:t:r")[:END_EVAL:]**

Any static text can be typed as you would like it to appear. There are two tags [:VIM_EVAL:] and [:END_EVAL:]. Any vim script function that is between the tags will be run. So in my blog template my first set of tags calculates today's date and time. The second set uses expand to insert the file name which I use for the zettelkasten ID.

Using templates can speed up your workflow and ensure consistency in document structure.


Zettelkasten ID vimtemplates-2020-05-12-0933