Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (91 sloc) 4.21 KB

saga

Now and then I see an app online where I realise it's a mainstream version of something I've created for myself. The new thing will have a friendly interface but tradeoffs I'd be uncomfortable with, such as giving someone else important data. Mine will be textual, and retain control of my data.

This entry is about a tool called saga, which has a similar purpose to evernote.

When you work on lots of projects and across multiple computer systems, it's really easy to lose data.

I generally think about data chronologically. I might forget the name I gave a project, but remember that I was working on it in August around the same time as another project that I do remember.

Saga creates directories which are named so that when you sort them all you get them back in chronological order.

Basic usage:

$ saga         # default usage echos the complete list of files
[...]
20111031.cturner.bump.aa.python.twisted.standardio.insults
20111108.cturner.bump.aa.freepascal
20111205.cturner.bump.aa.curses.client
20111221.cturner.bump.aa.golang
20111226.cturner.bump.aa.roguelike.messaround
20111230.cturner.bump.aa.moria
$ saga test    # this creates a new directory and echo the filename
/home/cturner/saga/20120101.bump.cturner.ad.test
$ saga -z      # echos the name of the most recently created dir
/home/cturner/saga/20120101.bump.cturner.ad.test
$ cd `saga -z` # dash z is useful for cd
$ pwd
/home/cturner/saga/20120101.bump.cturner.ad.test
$ 

Structures underneath:

$ cd $HOME/saga
$ cd saga
$ ls -lF
[...]
drwxr-xr-x  2 cturner cturner    4096 2011-10-31 17:21 20111031.cturner.bump.aa.python.twisted.standardio.insults/
drwxr-xr-x  2 cturner cturner    4096 2011-11-08 07:08 20111108.cturner.bump.aa.freepascal/
drwxr-xr-x  2 cturner cturner    4096 2011-12-05 22:39 20111205.cturner.bump.aa.curses.client/
drwxr-xr-x  4 cturner cturner    4096 2011-12-21 13:45 20111221.cturner.bump.aa.golang/
drwxr-xr-x  5 cturner cturner    4096 2011-12-26 15:18 20111226.cturner.bump.aa.roguelike.messaround/
drwxr-xr-x  3 cturner cturner    4096 2011-12-30 17:23 20111230.cturner.bump.aa.moria/

If we created another example for today, it would have 'ab' in the filename in place of 'aa' to retain order by creation time. This example is taken from a mostly inactive computer, so you can't see that in this example.

Note that we don't have to worry about the write-date of any of the directories. If you consolidate saga directories from several systems into one, you'd retain this.

I created this system originally because on any given day I'd deal with data from multiple customers and wanted to have perfect retention with a responsive system. No web bug tracking system could match this for speed. However, I've also found it very useful for capturing code snippets.

Searching:

$ saga | grep python
20090506.craig.xussbaum.aa.python.getopt
20090507.craig.xussbaum.aa.couchdb.python
20090707.craig.xussbaum.ac.cocos.python
20090717.craig.xussbaum.aa.bpython
20101031.cturner.bump.aa.python.wikitools.pattern.dev
20101031.cturner.bump.ac.python.fuse.pattern.dev
20101204.cturner.bump.aa.python.threading.roguelike.sir_lewk.tetrisrl
20110611.cturner.bump.aa.extending.python.with.c
20111031.cturner.bump.aa.twisted.standardio.insults
$ ls
example.py
$ cat example.py
#
# http://twistedmatrix.com/pipermail/twisted-python/2007-October/016109.html
#
# start with twistd -noy example.py
#
import os, tty, sys, termios

from twisted.application import service

from twisted.internet import reactor, stdio, protocol, defer
from twisted.python import failure, reflect, log
from twisted.protocols import basic
[etc]

You don't actually need any code to use the saga approach. In the early days I had no script. Then I created a shell script to help me out. Then I moved to python, and later added username and hostname.

The downside of this system is that it gives you more typing to navigate around the filesystem. Tab completion gets jammed on the year and you see lots of results. Some other time I'll write about another tool I've written to sit on top of this called silo. It solves the verbosity prooblem from several angles and allows for tagging. It uses symbolic links and doesn't introde on the silo foundation.

Code: http://songseed.org/exhibit/20120101/saga

You can’t perform that action at this time.