2012-02-10 20:03:20 +01:00
|
|
|
note 0.4 by Thomas Linden, 13/01/2000
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
|
============
|
|
|
|
|
|
|
|
|
|
This is a small console program written in
|
|
|
|
|
perl, which allows you to manage notes similar
|
|
|
|
|
to programs like "knotes" from commandline.
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
This version is completely rewritten and it is
|
|
|
|
|
able to display colored output.
|
|
|
|
|
|
2012-02-10 19:58:52 +01:00
|
|
|
You can add, edit, list and delete as many notes
|
2012-02-10 20:03:20 +01:00
|
|
|
as you want. You can run note from the commandline
|
|
|
|
|
or interactive from within your console.
|
|
|
|
|
|
|
|
|
|
There are now two version of note in one package:
|
|
|
|
|
o (binary) the binary version resists in the
|
|
|
|
|
subdirectory "binary-db".
|
|
|
|
|
It uses a binary file for data storage.
|
|
|
|
|
The format of this file will be described
|
|
|
|
|
later on.
|
|
|
|
|
o (mysql) the mysql version resists in the
|
|
|
|
|
subdirectory mysql-db. It uses a mysql
|
|
|
|
|
database as backend. There are some
|
|
|
|
|
special installation steps required in
|
|
|
|
|
order to run the mysql version which are
|
|
|
|
|
documented in the README within this
|
|
|
|
|
subdirectory.
|
2012-02-10 20:01:40 +01:00
|
|
|
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
|
============
|
|
|
|
|
|
|
|
|
|
You need the following things:
|
|
|
|
|
o perl installed (5.004x)
|
2012-02-10 20:01:40 +01:00
|
|
|
o The module IO::Seekable, which should be
|
|
|
|
|
already installed with your perl distributuion.
|
2012-02-10 20:03:20 +01:00
|
|
|
o Mysql.pm if you want to use the mysql version.
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Installation
|
|
|
|
|
============
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
Simple: Copy it to a place inside your $PATH,
|
|
|
|
|
probably as root. (for example to /usr/bin).
|
2012-02-10 19:58:52 +01:00
|
|
|
|
2012-02-10 20:03:20 +01:00
|
|
|
For installation instructions for the mysql version see
|
|
|
|
|
mysql-db/README.
|
|
|
|
|
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Configuration
|
|
|
|
|
=============
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
This version of note doesn't neccessarily need
|
|
|
|
|
a configuration file. But you can have one and change
|
2012-02-10 20:03:20 +01:00
|
|
|
some default values. Take a look to the file config/noterc
|
2012-02-10 20:01:40 +01:00
|
|
|
provided with this tarball. There are detailed instructions
|
|
|
|
|
about every available parameter.
|
2012-02-10 20:03:20 +01:00
|
|
|
Simply copy this file into your home-directory and name it
|
|
|
|
|
.noterc
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
|
=====
|
2012-02-10 20:03:20 +01:00
|
|
|
Usage of the mysql and binary version is similar, there
|
|
|
|
|
are only differences between the database backends of
|
|
|
|
|
each other.
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
If you don't know, how to run note, try "note -h" first.
|
|
|
|
|
It will tell you all available commandline options.
|
|
|
|
|
|
|
|
|
|
To create a new note, simply run "note". You can enter
|
2012-02-10 20:01:40 +01:00
|
|
|
the note (the length is by default limited to 1024 bytes,
|
|
|
|
|
which you can change from your config file).
|
2012-02-10 19:58:52 +01:00
|
|
|
End by typing a . on a line itself. note will tell you the
|
|
|
|
|
number of the note.
|
|
|
|
|
|
|
|
|
|
If you want to view the note, type "note 1", if the notenumber
|
|
|
|
|
was 1.
|
|
|
|
|
|
|
|
|
|
If you want to get an overview of all notes, type "note -l".
|
|
|
|
|
You will get a list of all notes, containing the number,
|
|
|
|
|
the first line and the creation date.
|
|
|
|
|
|
|
|
|
|
To edit a certain note, type "note -e 1". It will invoke your
|
|
|
|
|
editor (vi or pico). You can edit it, after saving, note
|
|
|
|
|
will store the changed note to the database.
|
|
|
|
|
|
|
|
|
|
Of course you can drop a certain note: "note -d 1" deletes
|
2012-02-10 20:01:40 +01:00
|
|
|
note number 1. If a note in the middle or the beginning of
|
|
|
|
|
the database will be deleted, note will recount the other
|
|
|
|
|
existent notes. For example there are 3 notes, number 1, 2
|
|
|
|
|
and 3. If you delete number 2, then number 3 will become
|
|
|
|
|
number 2.
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
If you cannot remember, which note you are looking for, you
|
|
|
|
|
can use the search capability of note: "note -s <searchstring>".
|
|
|
|
|
note will search the whole note database case insensitive for
|
|
|
|
|
an occurence of this string and tell you the number and first-
|
|
|
|
|
line it have.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-10 20:03:20 +01:00
|
|
|
Format of the notedb (binary version)
|
2012-02-10 20:01:40 +01:00
|
|
|
====================
|
|
|
|
|
|
|
|
|
|
The database where the notes are stored is a binary file of
|
|
|
|
|
the following format:
|
|
|
|
|
It consists of three fixed length fields per entry. The fields
|
|
|
|
|
have the following types:
|
|
|
|
|
o Number: Integer (1 byte)
|
|
|
|
|
o Note: String (default 1024 bytes)
|
|
|
|
|
o Time: String (default 64 bytes)
|
|
|
|
|
You can change the sizes of the fields "Note" and "Time" in
|
|
|
|
|
the configfile "~/.noterc". If it does not exist, the above
|
|
|
|
|
defaults will be used.
|
|
|
|
|
If the data to be stored is smaller then the size of the field,
|
|
|
|
|
it will be filled with ZERO's ("\0"). The Note and the Time
|
|
|
|
|
fields will be uuencoded before storage. Of course, this is
|
|
|
|
|
no security, never mind...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Security
|
|
|
|
|
========
|
|
|
|
|
|
2012-02-10 20:03:20 +01:00
|
|
|
You can't use the following hints with the mysql version!
|
|
|
|
|
Refer to the mysql manual for more informations about
|
|
|
|
|
security of mysql databases:
|
|
|
|
|
http://www.mysql.org/Manual_chapter/manual_Privilege_system.html
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
If you want to protect the notedb against unauthorized persons
|
|
|
|
|
(even root), you might want to use pgp. I use gpg (GNU privacy
|
|
|
|
|
guard), which is compatible to pgp, usage should be similar.
|
|
|
|
|
You could add a function to your .profile or .bashrc or whatever:
|
|
|
|
|
--- snip ---
|
|
|
|
|
function note
|
|
|
|
|
{
|
|
|
|
|
gpg -o ~/.notedb -d ~/.notedb.gpg
|
|
|
|
|
note $1 $2 $3
|
|
|
|
|
gpg -e ~/.notedb --yes -r username
|
|
|
|
|
rm -rf ~/.notedb
|
|
|
|
|
}
|
|
|
|
|
--- snip ---
|
|
|
|
|
You should replace <username> with your real username. After applying
|
|
|
|
|
this function to your .profile, issue the following command:
|
|
|
|
|
"source .profile"
|
|
|
|
|
You shell will reread the file, so you can try it out without the need
|
|
|
|
|
of new login.
|
|
|
|
|
This function assumes, there exists a file called "~/.notedb.gpg",
|
|
|
|
|
therefore you need to encrypt your notedb once before you can use this
|
|
|
|
|
funcion:
|
|
|
|
|
"gpg -e ~/.notedb --yes -r username"
|
2012-02-10 20:03:20 +01:00
|
|
|
|
|
|
|
|
Here is, how to do it with pgp, create a shell script with the following
|
|
|
|
|
content:
|
|
|
|
|
--- snip ---
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
/bin/echo -n "passphrase:"
|
|
|
|
|
pgp -o ~/.notedb -d ~/.notedb.pgp > /dev/null 2>&1
|
|
|
|
|
rm -f ~/.notedb.pgp > /dev/null 2>&1
|
|
|
|
|
note.pl $1 $2 $3
|
|
|
|
|
pgp -e ~/.notedb tlinden > /dev/null 2>&1
|
|
|
|
|
rm -f ~/.notedb > /dev/null 2>&1
|
|
|
|
|
--- snip ---
|
|
|
|
|
Do "chmod 700 whatevername". That's it.
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
If you don't make use of encryption, I suggest you to chmod it:
|
|
|
|
|
"chmod 600 .notedb"
|
|
|
|
|
So, only you can read the file (and root or any intruder who became root).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-10 19:58:52 +01:00
|
|
|
Comments
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
You can send any comments to Thomas Linden <tom@daemon.de>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
License
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
This program is GPL.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Author
|
|
|
|
|
======
|
|
|
|
|
|
2012-02-10 20:01:40 +01:00
|
|
|
The author is Thomas Linden.
|
2012-02-10 19:58:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Last changed
|
|
|
|
|
============
|
|
|
|
|
|
2012-02-10 20:03:20 +01:00
|
|
|
13.01.2000
|