notes about computers by ~pgadey rss
dotfiles
201e-03-01

stow + git = version controlled dot files

Today I set up my system to use version controlled dotfiles via stow and git.

What are 'dotfiles'? They are configuration files that allow one to customize the behaviour of programs on Linux. They specify key-bindings, colour themes, etc. in plain text files. Often they are very personal. It is a little dizzying to use a familiar piece of software without the usual dotfiles in place.

What is GNU stow? It is a symlink manager that allows you to deploy and remove collections of symlinks conveniently. One creates several "packages" in directories, and then stow manages the task of creating or removing symlinks to the various files in these packages.

What is git? Git is Linus Torvald's other wunderkind. It is a version control system that tracks how files have been modified. Presently, it is the industry standard.

Example stow Usage

stow manages packages of files in the following way: A package is just a directory of files. When you stow a package, it will create symlinks to all the files in the package together with the appropriate file hierarchy.

For example, suppose you have the following file structure:

 ~/dotfiles/foo
 ├── .foorc
 └── .config
     └── foo-config

 ~/dotfiles/bar/
 ├── .bar.ini
 └── .config
     └── bar
         ├── bar-config
         └── bar.theme

That is, you've got a dotfiles directory containing two packages foo and bar. Notice that both packages contain directories called .config. These directories allow you to seperate out the parts of the package foo that go in to ~/.config and the parts of bar that go in to ~/.config

If you enter the directory ~/dotfiles/ and run stow foo it will create symlinks at ~/.foorc and ~/.config/foo-config which point to the corresponding files in your dotfiles directory.

If you enter the directory ~/dotfiles/ and run stow bar it will create symlinks at ~/.bar.ini and ~/.config/bar/bar-config and ~/.config/bar/bar.theme which point to the corresponding files in your dotfiles directory.

(By default stow installs the package the directory containing the current working directory. One can change this using stow -t TARGET.)

Managing Dotfiles with Stow and Git

I followed the advice these people put up:

To get started:

  • Make a ~/dotfiles/ directory.
  • Initialize a git repo in that directory using git init.
  • Make a sub-directory for each package of configuration files you want to track. E.g: vim, screen, mc.
  • Copy the configuration files you want to track in to each ~/dotfiles/package/ directory.
  • Run stow --adopt package to adopt current dotfiles for each package.
  • Run git add . to add all the new file to the git repo.
  • Run git commit to commit the new files.
  • Run stow package to stow each package.

To maintain your repo:

  • Everytime you change a dotfile, update the git repo using git add .changed-dotfile
  • Commit when you feel like it.

Other useful things:

  • stow -D package removes the symlinks to a package
  • stow -R package to reload package. It removes, and then re-stows it.

ssh and vim

Two things that hose dotfiles I'd like to track are ssh and vim. Unfortunately, ~/.ssh/ and ~/.vim/ both contain sensitive data. One has my private keys, and the other has temporary files related to potentially sensitive documents.

Thus, I only track the relevant non-sensitive data in ~/dotfiles/

 /home/pgadey/dotfiles/ssh/:
    .ssh

 /home/pgadey/dotfiles/ssh/.ssh:
    config
    known_hosts

 /home/pgadey/dotfiles/vim/:
    .vim
    .vimrc
    snippets
    plugin

 /home/pgadey/dotfiles/vim/.vim/plugin:
    emmet.vim
    matchit.vim
    snipMate.vim
    surround.vim

 /home/pgadey/dotfiles/vim/.vim/snippets:
    tex.snippets
    vim.snippets

tl;dr

 $ mkdir ~/dotfiles/

 # setup the package of dotfiles for foo
 $ mkdir ~/dotfiles/foo/
 $ cp ~/.foo ~/dotfiles/foo/
 $ mkdir ~/dotfiles/foo/config/
 $ cp ~/.config/foo-config ~/dotfiles/foo/.config/foo-config

 # adopt the currently existing files for the package foo
 $ cd ~/dotfiles/
 $ stow --adopt foo

 # create symlinks for the package foo
 $ stow foo
Screencasting With Gimp
2017-02-16-4 at 16h

Screencasting from GIMP

The current setup for screencasting with GIMP:

  • Open up GIMP
  • Open up gtk-recordmydesktop
  • Wacom Tablet (Intuous Pro 5 Small)

Issues

  • Use Ubuntu Unity because it plays well with the Wacom Tablet (Intuos Pro 5)
  • GIMP cannot cycle through pen colours: use the plugin color.py (local mirror)

Current Key-Bindings

  • ctrl-` : cycle through foreground colours

  • Wacom Left #1 (Top-top) -- zoom in

  • Wacom Left #3 (Top-bottom) -- zoom out

  • Wacom Left #4 (Bottom-top) -- Colour cycle

  • Wacom Left #5 (Bottom-mid) -- Undo

quizbot
2016-10-22-6 at 17h

GOAL:

Generate a quiz for each TA

INPUT:

Description of the course and quiz to be generated
    A31,6,Quiz \#6 on Limits
    TUTO01-Alice
    TUT002-Bob

    The first line contains, in CSV,
    COURSE,QUIZ NUMBER, QUIZ TITLE

    All other lines contain text which will used to fill TUTORIAL

A folder of files:
    ./course.csv
    ./template-head.tex
    ./template-foot.tex
    ./question-1/variant-1.tex
    ./question-1/variant-2.tex
    ./question-1/variant-3.tex
    ./question-2/variant-a.tex
    ./question-2/variant-b.tex
    ./question-3/foo.tex
    ./question-3/bar.tex

OUTPUT:

A bunch of quizzes
    ./quizzes/A31-Quiz-6-TUT001-Alice.tex
    ./quizzes/A31-Quiz-6-TUT002-Bob.tex
    ./quizzes/COURSE-Quiz-N-TUTORIAL.tex

Example:

Very simple example of this set up is available here: quizbot-example.zip

$ cat ./course.cv

A31,6,Quiz \#6 on Limits
TUT001-Alice
TUT002-Bob

$ cat ./template-head.tex

\title{\QuizBotCourse -- Quiz \QuizBotNumber -- \QuizBotTitle}

\documentclass[12pt]{article}

\begin{document}
\maketitle

$ cat ./template-foot.tex

\end{document}
This is never printed

$ quizbot.sh

generating : A31-Quiz-6-TUT001-Alice
generating : A31-Quiz-6-TUT002-Bob

$ cat ./quizzes/A31-Quiz-6-TUT001-Alice.tex

\newcommand{\QuizBotTitle}{Quiz \#6 on Limits}
\newcommand{\QuizBotNumber}{6}
\newcommand{\QuizBotCourse}{A31}
\newcommand{\QuizBotTutorial}{TUT001-Alice}
\title{\QuizBotCourse -- Quiz \QuizBotNumber -- \QuizBotTitle}

\documentclass[12pt]{article}

\begin{document}
\maketitle
%% begin:  ./question-1/variant-1.tex
What is $\pi$
%% end:  ./question-1/variant-1.tex 

%% begin:  ./question-2/variant-a.tex
\[ \cos(a+b) \]
%% end:  ./question-2/variant-a.tex 

%% begin:  ./question-3/bar.tex
Aloha
%% end:  ./question-3/bar.tex 

\end{document}
This is never printed
office cam
2016-09-14

This is the current implementation of cam.sh. It takes a photo of the whiteboard, uploads it, and then processes it on cloudbox. The processing is pretty minor: it sharpens the image and makes a thumbnail.

 #!/bin/bash

 server='cloudbox'
 localStore='/home/pgadey/cam'
 remoteStore='/home/pgadey/public_html/office/cam'
 fileName=`date +%F+%T`.jpeg


 streamer -o $localStore/$fileName -j 100 -s 1280x720
 scp $localStore/$fileName $server:$remoteStore/$fileName

 ssh $server "mogrify -verbose -sharpen 0x1.5 $remoteStore/$fileName"
 ssh $server "mogrify -verbose -thumbnail 127x72 -path $remoteStore/thumbs/ $remoteStore/$fileName"

It would be nice to add some more functionality to cam.sh:

  • An argument for comments about the shot
  • An argument for naming the shot

The photos are available here: http://pgadey.ca/office/cam

office
2016-09-10

dotfiles

meta-notebook manager

  • definitions

    • a page is a pdf of a single page of paper (US-letter)
    • a commentary is a set of human readable plaintext files
    • a note is a directory containing pages and a commentary
  • what is a commentary?

    • the human readable part of the note
    • it at least has a title and some kind of a type: is this note a chapter? a course?
    • some tags
    • a bunch of tiny text files
      • project details
      • progress report stuff
      • code
      • details about pages
      • it might even have some latex to compile
      • markdown blog entry / discussion
  • to assemble a note (e.g. foo) do several things:

    • assemble the commentary
      • if there is no commentary: make a minimal one with date of assembly
      • if there is a commentary:
        • log changes to commentary using git
        • put together the html version (use bake)
    • assemble the pages in pdf format
      • create a pdf of all the pages: foo.pdf
      • create a compressed pdf of all the pages: foo-tiny.pdf
    • assemble a simple web gallery:
      • create png versions of the pages
      • create png-thumbnail versions of the pages
      • create an html gallery of the png images: include the commentary
  • a sub-note is a directory inside a note

    • RECURSE!
    • the commentary of a note can describe how to assemble its sub-notes
    • thread-view of notes

whiteboard photos

  • single press button which takes a photo of whiteboard
  • puts the photo in a gallery together with minimal commentary (date)
  • the commentary allows photos to be tagged
  • name files (yyyy-mm-dd-N.png ?)
  • generate a very simple "permalink" to photo (md5 the photo or passphrase style?)

potential alternative use: simple use document scanner, book cataloguer

timelapse garden

  • it suffices to consider a single plant
  • automagically photograph a plant using a webcam every N seconds (timelapse)
  • allow for special frames or snapshots which illustrate something
  • stores the photos in a reasonable place related to the plant
  • name files (yyyy-mm-dd-hh:mm:ss.png -- O Time Thy Pyramids!)
  • allow for a commentary about the plant

  • to assemble a plant timelapse:

    • make a variety of scales of timelapse: 100x 10x 1x
    • make several different formats
    • generate a simple web page for the plant
    • specific hours of activity?
  • potential alternative use: weather station

poisson pings (time usage monitor)

  • pings according to a low intensity markov process
  • audible/visible chime
  • asks for tags describing current mental head space
  • what tasks are being done in the office, guests, students, etc
  • timelapse photo with face camera
  • timelapse photo with window manager screenshot
  • may give pleasant fortune?
  • specific hours of activity?

noise generator

future

  • lending library
  • real weather station
  • morse code whistling droid

    Perhaps plants, courses, articles, studies, etc. are all notes. A meta-notebook note has unique plaintext named images with individual commentaries, and a comment on the note as a whole.

Journal
2016-08-22

I have kept a hand written journal since I was a kid. The old lady we went to the theater with told me to keep a journal. Her advice stuck with me. That moment, in Aunt Kay's hallway, was a life changing experience for me.

Today was another milestone in journalling for me. Today, I carefully re-read the last several volumes of my handwritten journal looking for underlined passage which represent subject headings. These underlined key words serve to provide a series of "hyper links" within the hand written journal. They make a paper book about as useful as an online tool. This is the solution that I've adopted to the computer geek's dilemma:

Should I keep a blog or a hand written journal?

My answer is: Keep a hand written journal with a thorough index. You can consult your notes using the index, and this will allow you to "grep dead trees". Most journal entries that I write are personal, semi-private, matters. Writing with a pen on paper allows me to "keep part of my life offline".

Hand writing notes allows a flexibility of description and illustration that I find impossible to get with a computer. It is too difficult, for me at least, to make drawings or type math quickly on computers. The interface of the computer gets in the way. To put it plainly -- writing on paper is relaxing compared to writing on a computer.

Computers were made for tabulating indices.

Paper, pen, and notebook work well together.

Pen, paper, notebook, and computer generated index work perfectly together.

Today, I hunted down the underlined subject keywords and carefully stowed them away in plain text files. Once everything was typed in, I had the following epic computing experience:

$ ## look around and see the directory tree
$ ls
 date  date.all  days.all  JournalIndex.pl  subject  subject.all

$ ## really look deep in to the directories
$ ls -R
 .:
 date  date.all  days.all  JournalIndex.pl  subject  subject.all

 ./date:
 date.0  date.2  date.4  date.6  date.8  days.0  days.2  days.4  days.6  days.8
 date.1  date.3  date.5  date.7  date.9  days.1  days.3  days.5  days.7  days.9

 ./subject:
 subject.0  subject.2  subject.4  subject.6  subject.8
 subject.1  subject.3  subject.5  subject.7  subject.9

$ ## examine the structure of the date file for Volume 2
$ head ./date/date.2 
 2014-05-30:
    Robert Young
    Spadina Library
 2014-06-03:
    Yevgeny Liokumovich
    Green Beanery
    Khazakstan
    pgadey.com
    pgadey.ca
    UNIX


$ ## display the number of dates plus links in each volume
$ wc -l ./date/date.*   
  902 date.0
  492 date.1
  454 date.2
  500 date.3
  456 date.4
  294 date.5
  322 date.6
  374 date.7
  407 date.8
  318 date.9
 4519 total


$ ## index volume 7
$ ./JournalIndex.pl ./date/date.7 > ./subject/subject.7


$ ## index all volumes (date listing to subject listing)
$ cat ./date/date.* > ./date.all
$ ./JournalIndex.pl ./date.all > ./subject.all

Indexing all volumes. total days plus subjects total subjects total entries

$ ## total number of days plus subjects
$ wc -l ./date.all
 4797 ./date.all

$ ## total number of subjects
$ wc -l ./subject.all
 2150 ./subject.all


$ ## extract the days from days plus subjects from volume 9
$ cat date.9 | grep ^20*  > days.9

$ ## how many days have entries?
$ wc -l days.all
 481 days.all

The first eleven volumes (Vol. 0 to 10) contain the period from 2013-10-24 to 2016-08-21. That is, 1033 days, or about two years and nine months. The numbers show, on average, I wrote on 46%=481/1033 of all days.

"When I was a kid ..."

This current software setup is a long way from the early journals that I wrote in highschool. Roy MacDonald really helped me get started in journaling. He raised, with his own life, journaling to the level of a vocation. He was called to journal. Allow me to show you a broadsheet poster that Roy wrote:

 Journals Are ...

... an important way of confronting the confusions of our world and the complexities of life. They are an assertion of our personal worth and individuality.

... open and available to everyone who can write a few words on paper and to everyone who wishes to consider this experience of living.

... often written in the heat of the moment, at the scene, and without reflection. They are the record of immediate experience and original feeling. 

... natural resources which writers may store away for future use in prose or poetry.

... recordings of developing concepts, attitudes, ideas. They help to review our own progressions, changes, and patterns of behaviour.

... a source of stimulation for writers and are helpful in overcoming writing blocks. Often the basic recording of specific time and place details can generate other thoughts and recollections which encourage writing.

... useful in reviewing and reinforcing things we have learned and wish to remember.

... helpful in keeping us in touch with out ancesotrs and in projecting something of ourselves onward to future generations.

... miscellanies of things we find meaningful: a series of lines, verses, and quotations encoutered in our daily life.

... private worlds and secret places of our own where are free to be exactly who we are and to say exactly what we want to say.

 Roy N. MacDonald, 1981 

 To Parker, in friendship Roy, London Oct 28, 2010
 I wish you good writing and a wonderful life.

I agree with everything Roy wrote, and more. He was the model journaller for me. I think that the importance of a private journal for research was first taught to me by Roy.

On the other hand, Derek Krickhan models perfectly the private computer journaller. He has a 'fancy typewriter' that we writes all his entries in to it. I warn him, every chance I get, to back them up. No one knows if they ever come out of the fancy typewriter.

Heru Sharpe got me started on rather "experimental" journalling. He is a hardcore Kabbalist, and takes notes about all sorts of things. I'm sure that there is a lot of fascinating poetry, reflection, and alchemy in his journal. He got me writing about my own "investigations".

My interests in recreational reading, computer programming, naturalism, indoor gardening, astronomy, foreign languages, and low complexity art all show up under various guises in my journal. There are a lot of low level tricks built in to how I mark my entries. By selecting subject keyphrases carefully, one can emulate tags, categories, timing. Using a pen one can handle multiple written languages, various fonts, math, figures, etc. You can glue in interesting bits of paper.

The sky is the limit with hand written, well structured, notebooks.

Computers and Classrooms
2016-08-17-3 at 02h
  • Ursula Franklin

    • Holistic/Prescriptive
    • The Sense of the Classroom
    • Handbooks and Textbooks
    • Computers in Classrooms
    • Classrooms in Computers
  • Effective Scales:

    • 1 -- Tutoring
    • 2 -- Conversation
    • 15 -- Small Class
    • 100 -- Class
    • 100,000,000 -- Proper Class
  • MAT 237

    • Cryptographic game-ification of "content delivery"
    • Large and provably true promises to students (50% Big List)
    • Slides, Problems, Slides
    • Statistics of responses (Shannon entropy)
    • The Good:
      • The asymptotic analysis of information transfer argument
        • Chalk-and-Talk: one-to-n communication: O(n) information
        • Multiple-Choice-Split-and-Chat: (1/2 n)(1/2 n) = O(n^2) information
      • Core group of students who accepted the method.
      • Students worked very hard on the Big List.
      • Great office hours.
      • The prep work is much more fun.
    • The Bad:
      • Voter apathy.
      • Please vote. Voter apathy.
      • Students give up on parts of the gamification they do not enjoy.
      • Voter apathy. Do -- um -- something please.
      • Lectures are even more boring to deliver.
      • Epsilon attendance in morning lectures.
      • Students attempted, and failed, to meta-game the Big List.
    • The Ugly:
      • We pass over the Ugly.
    • Room for Improvement:
      • Enforced voting.
      • Enforced group discussion and completion of worksheets.
      • Statistics of responses (flashcard scheduling, Hermann Ebbinghaus 1885)
        • ``We need more data!''
        • ``Wir müssen wissen, wir werden wissen!" -- Hilbert
meta bake
2016-07-01

I've been using bake to maintain this collection of notes.

To make things a little bit better, I've written a little script that I call meta-bake to bake all the subdirectories of my home folder that should be baked. This means that every instance folder in my notes directory gets hit.

This might be useful for other people using multiple bake blogs on ctrl-c.club

#!/bin/bash
find . -name 'bakefile' -execdir bake {} +;
find . -name 'bakefile' -execdir git commit -m meta-bake {} +
Plant Cam
2016-07-01

I have a webcam that I use to make timelapse videos of plants growing. There is also a lamp on a timer to keep the plant well lit through the night.

This is a local link to the cam.

Hardware:

  1. RaspberryPi (Thanks, Nick!)
  2. Lamp and timer
  3. Microsoft LifeCam HD-3000 (Res: 1280 x 720)

The first shot (2016-04-22):

The most recent shot (2016-07-01):

The data dump from the recent look at the hard drive.

 2016-07-01

 pgadey@raspberrypi /media/backup/webcam $ time du -hc | tail
 27G     .
 27G     total

 real    44m8.222s
 user    0m13.440s
 sys     1m13.520s
 pgadey@raspberrypi /media/backup/webcam $ ls | tail

 998-20160626111303-00.jpg
 998-20160626111304-00.jpg
 998-20160626111305-00.jpg
 998-20160626111306-00.jpg
 998-20160626111400-snapshot.jpg
 999-20160626111446-00.jpg
 999-20160626111446-01.jpg
 999-20160626111446.swf
 999-20160626111500-snapshot.jpg
 lastsnap.jpg
Backup System
2016-04-23-6 at 00h

I am trying to set up a home back up system that I like. The goal is to have a place for storing my pdf library and pictures safely. Additionally, it would be nice to have music and videos conveniently accessible.

Presently, the plan is to have a central respository of stuff on an external hard drive attached to a RPi. I'm going to use sshfs to connect it all up.

Backup stuff:

  1. RaspberryPi (Thanks, Nick!)
  2. Seagate 1.5 Tb Expansion Portable (Model: SRD0NF1)
  3. Kingston 16Gb DataTraveler SE9
William Shotts Quote
2016-02-11-4 at 00h
Graphical user interfaces (GUIs) are helpful for many tasks, but they are not good for all tasks. I have long felt that most computers today are not powered by electricity. They instead seem to be powered by the "pumping" motion of the mouse! Computers were supposed to free us from manual labor, but how many times have you performed some task you felt sure the computer should be able to do but you ended up doing the work yourself by tediously working the mouse? Pointing and clicking, pointing and clicking.

I once heard an author say that when you are a child you use a computer by looking at the pictures. When you grow up, you learn to read and write. Welcome to Computer Literacy 101. Now let's get to work.

William Shotts -- LinxCommand.org

Textual Machines
2016-02-11-4 at 00h

Computers are the machines which manipulate text. Other machines might manipulate the physical world for humans benefit, but computers manipulate symbols for our benefit. Most people fault computers for not being 'fast' or 'smart', but computers only seem so because we've asked them to attempt the impossible: we wish them to simulate reality in a way that is pleasing to us.

If we lowered the bar on what we'll accept for a satisfying computer experience, then we'd all be rich beyond measure in terms of computing resources. As a means of transmitting, displaying, and re-arranging bits we know for a certainty that computers are great. We can have a great deal of fun with a simple network of tiny computers. The trick is to stick to what textual machines are good at doing for us. So, please remember that your computer is really quite good; you're just asking it to do the impossible.

comm
2016-02-11-4 at 00h

Some tips on tools for communication / socializing

Learn to use screen.

screen lets you use multiple terminals through one ssh session; screen is very handy for multi-tasking. The most basic functionality is as follows: Run screen, then use the following key combinations. ctrl-a x means press ctrl and a simulataneously then release and type x.

  1. ctrl-a c will open a new terminal.
  2. ctrl-a " will list all open terminals.
  3. ctrl-a A will prompt to rename the current terminal.
  4. ctrl-a K will prompt to kill an active terminal.
  5. ctrl-a ? will bring up a useful cheat sheet.

As usual, check out man screen for all the details. screen is very helpful for keeping documentation up.

Chatting

  1. In a new terminal, run watch who to see if anyone is currently on the server. This information will update every two seconds. Each line lists a person who is logged on, what terminal they are connected to, and when they logged on.
  2. To check how long someone has been idle, try finger USERNAME. This will tell you how long their terminal has been idle for.
  3. If someone is online, you can try to communicate with them through write. Try write USERNAME, type out your message, and then finish it by pressing ctrl-d (ctrl-d is interpreted as end of file). If they don't respond you can try write USERNAME TTY where the username and tty are taken from the output of who.
  4. To send all currently logged on users a message, type wall and proceed as with write. Be careful, since this is pretty noisy. Use sparingly.
  5. If you want to disable / control how you get the contents of write and wall commands read man mesg.

Listing info about yourself

  1. To find out about another user, type finger USERNAME.
  2. The last part of the output of finger is the contents of the user's .plan file.

    The .plan file is a free form text document. You can use it as a place to say a bit about yourself, your plans on ctrl-c.club, or anything else that you feel like. Go nuts.

  3. To edit your plan file, type nano ~/.plan.

sync
2016-02-11-4 at 00h

Automagic uploading with rsync and ssh sshfs

This page documents the brief script that I use for working with various remote servers using sshfs. The magic of sshfs makes working with remote file systems feel exactly like working with the local file system. For instance, it makes working with ctrl-c.club and my server, cloudbox, almost effortless.

The script below assumes the following set up: A local directory ~/sshfs/ with one folder per remote location, named after the host alias for that remote location as specified by ~/.ssh/config. My ~/sshfs/ directory looks like this:

    ~/sshfs/:
        ~/sshfs/cloudbox/
        ~/sshfs/tilde.works/
        ~/sshfs/ctrl-c.club/

and my ~/.ssh/config looks like:

    Host cloudbox
        Hostname pgadey.com
    Host tilde.works
        Hostname tilde.works
    Host ctrl-c.club
        Hostname ctrl-c.club

Further more, it assumes that every remote location has the same set up: One has the same username pgadey on each server and content is kept in remote:/home/pgadey/. Here is the script that I use to push new material to these hosts: (sync.sh)

    #!/bin/bash

    # use $sudo umount ~/sshfs/*
    # to unmount everything

    LIST="ctrl-c.club cloudbox tilde.works"

    for d in $LIST; do
        read -p "Do you want to mount $d (Y/[N])?" answer
        case $answer in
        [Yy]* ) sshfs $d:/home/pgadey/ /home/pgadey/sshfs/$d/;;
        * ) echo "Not mounting $d.";;
        esac
    done
generated by bake