Text Knowledge Base, Backups and More

2022-06-07

You may have noticed that I took a little break from publishing any posts, which I mentioned I am prone to do when I started this blog. However, I came back with force last month, and I looked back over my past blog posts and noted what tools have changed and remained the same over the past few years. I thought it might be interesting to look at a few of my old posts and note where I have pivoted and where I have not.

Four years ago, I wrote about building an accessible knowledge base, and I am proud to be using the same tools four years later. My advice to buy into a solution you are passionate about and perhaps build some of it yourself was good. I sometimes still fiddle with the buz profile function I wrote for remembering those one-liners, single commands, or short notes that are helpful to bring up quickly but are easily forgotten when you only need them a few times a year. Here is what buz looks like today, written for bash on macOS.

buz() {                                                                       
  if [ ! -z "${1}" ]; then
    # Using the "${@:2}" here will take all parameters passed into
    # buz after the first argument. 
    NOTES=$(echo "${@:2}")
    grep -i -m 1 "^${1}:" ${HOME}/Sync/notes.yml >/dev/null
    if [ $? -eq 0 ]; then
       sed -i '.bak' 's|'^${1}:'|'"${1}:\n \-${NOTES}"'|' ${HOME}/Sync/notes.yml
       rm -rf ${HOME}/Sync/notes.yml.bak
       less ${HOME}/Sync/notes.yml
    else
       SUBJECT="$(echo ${1} | tr [A-Z] [a-z])"
       printf "${SUBJECT}: \n -${@:2} \n" >> ${HOME}/Sync/notes.yml
    fi
  else
    # If no arguments were passed, our file would print out
    # to the screen.                                                
    cat "${HOME}/Sync/notes.yml"                                                  
  fi                                                                            
} 

With buz, I can type just buz, and the function prints the content of my file, which I could pipe to grep or whatever command I choose. To add more content to my notes, I type:

buz topic and notes about the topic I just typed.

I chose YAML because the syntax allows me to put the topic I am taking notes about at the start of the line and then entries underneath the topic. Within the function, I search to see if the topic already exists; if so, the note is appended under the topic; if it is not found, a new topic and note are created. I end up with a YAML file that looks something like this.

subject1:
 -notes on the subject
 -more notes on the subject
subject2:
 -notes on the subject
 -more notes on the subject
 -as many notes, as you want on the subject 
subject3: 
 -notes on the subject

Remember, this function is for short notes, nothing detailed. Detailed notes go in my more extensive knowledge base, my wiki. If you use this function and have improvements, I would love to hear about them. Please reach out to me.

I still use vimwiki every day; the daily diary feature is excellent for keeping my daily notes and a task list. And my wiki of technical notes continues to grow. I am a HUGE fan of keeping everything in all text. The benefit is that the files will still be accessible in 2032, while the fancy note-taking application you downloaded will be long gone, and the files it created will be lost forever.

Two years ago, I wrote about giving up Google in 2013 and what applications I have replaced Google products with. Most of those items have remained the same, but let’s review.

Two years ago, I also wrote about backups because of a bug that affected Time Machine backups. After writing that post, I have since re-engineered Rapid Redux, my backup solution to use Restic instead of Rsync. Despite this change, Rsync is still a fantastic technology that I still use to copy files locally and remotely. But Restic is actual backup software, written in Go, and yes, I know there is a Google connection. It does proper incremental backups with snapshotting and is very fast. I am writing one copy to my 10-year-old HP ProLiant N40L running FreeNAS and another to an offsite location. I hope to be soon able to also backup to Proton Drive, but the interface is still web only. I hope for an API or the ability to mount the Proton Drive storage. The only thing that has changed for me is using Restic instead of Rsync in my Rapid Redux tool. I still use Time Machine. Time Machine has been fantastic for reinstalls or moving to new hardware.

Speaking of Rapid Redux, I did not mention it in the previous post, but the beginnings of that tool predated any configuration management tool that I am aware of. Rapid Redux, it was not called that then, was a collection of scripts written in a shell script, Perl, and whatever else my coworkers and I were comfortable with, and we wrote it in the early 2000s, with some parts beginning in the late 1990s. It was a configuration management tool that my Unix sysadmin coworkers and I wrote together. The initial beginnings started on AIX and the RS/6000, and we utilized the private networking technology to push configurations and commands beyond what many were doing at the time. I recall working with many IBMers who were quite impressed with the toolset and automation we built. But the real growth was when we added SSH, at which point we were essentially doing everything you see Puppet, Ansible, and SaltStack doing now, with what was possible in the early 2000s. There is more to tell; we briefly marketed our product and had customers, then the housing market crashed, which affected those customers. So I still use pieces of that product, Rapid Redux, to this day.