ThoughtPy

Version 1.0
Command-Line Note-Taking Program

ThoughtPy is a super-fast way from the command-line to add a timestamped note to a file, and then list or search those notes.

Installation:

  • Download thoughtpy-1.0.zip and extract.
  • You need Python 3.5 or later.
  • Move thought.py somewhere in PATH, I use a ~/bin directory on Mac OS X.
    • Make sure it's executable: chmod +755 ~/bin/thought.py
    • Default directory to save notes is ~/Dropbox/Apps/ThoughtPy/, configure it in ~/.profile with export THOUGHT_DIR=
    • Default uses the system editor (echo $EDITOR), configure it in ~/.profile with export THOUGHT_EDITOR=nano
  • thought.py -h will show usage.

Example

(Boldface is what I type, plain is what the computer types.)

% thought.py
# 2017 main

## 2017-01-01 00:00:00 PDT -0700
Hello, notes
1. Agenda
2. Exegesis
3. Eschaton
^X
% echo "Turning & turning in the widening gyre"|thought.py -
% thought.py -l
# 2017 main
## 2017-01-01 00:00:00 PDT -0700
Hello, notes
## 2017-01-01 00:01:00 PDT -0700
Turning & turning in the widening gyre
% open -a Markoff `thought.py -p`

What Else?

This is a tool for efficient nerds who are always at the command-line. I work on Mac, and I'm sure it's fine on BSD or Linux, probably works on Windows but I have no idea. If you're looking for a GUI note program, I used to offer apps like ThoughtPad and Notecraft, but there's a million other GUI options like Yojimbo, Apple's Notes, etc.

I suggest using nano as the editor; I work in BBEdit and sometimes Atom or Vim, but a chainsaw's the wrong tool for writing a note.

export THOUGHT_EDITOR=nano

Configure it with ~/.nanorc:

set backup
set backupdir ~/tmp
set historylog
set tempfile

set morespace
set boldtext
set const
set smooth

set autoindent
set cut
set nowrap
set regexp

Markdown previewing (of a filename from thought -p) is left as an exercise for the user, but on Mac OS X I suggest Markoff (free), Marked 2 ($13.99), or overengineering it with MultiMarkdown and scripts and style sheets, because that's more fun than working.

Encryption's a harder problem. Currently it's only as private as your filesystem (hopefully you have full-disk encryption), and Dropbox or anywhere else you make backups. Adding complexity to a little program, passing unencrypted text to an editor, etc. is dangerous business.

An easy way to get portable encryption on Mac OS X is to make an encrypted disk image with Disk Utility, and set THOUGHT_DIR to it. You'll have to mount it whenever you want to use it and unmount it when done, but it can be placed anywhere, even synced and backed up without risk. Something like this script:

hdiutil attach ~/Desktop/secure.dmg
# will prompt for password
oldthought=$THOUGHT_DIR
export THOUGHT_DIR=/Volumes/secure
thought.py "$@"
export THOUGHT_DIR=$oldthought
hdiutil eject /Volumes/secure

License

ThoughtPy
Copyright © 2017 Mark Damon Hughes

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Comments are closed.

    Mentions

  • 💬 Tools - Mark writes