01.04.2009 23:32
Employing org-mode
Since I
started using
org-mode I employed its simple format on many different documents,
not just limiting it to manage my agenda. For example it's a great
format for documenting systems I maintain; all system information,
changes, security updates etc. are stored in per-system org files. I
also use it for all projects I work on. Once terms are set I will open
a new project.org file and start outlining tasks. Later all
kinds of sensitive information will be added, and this brings up the
issue of security, I wrote
about encrypting
file-systems but additionally I also encrypt every sensitive file
with GPG. This is where EasyPG
for Emacs fits in, it allows transparent en/decryption of files
while ensuring nothing gets leaked outside of Emacs.
It's not as simple as some (custom) systems I've seen but it's a
complete solution. Freelancing from home I had to come up with
something to make my life easier and my hands weren't tied by some
office rule or regulation. The same setup can be used to keep your
passwords, logins, bank account and other personal information. Org's
table mode is a good format for those files.
Along with project.org I also have report.org files
for every project, holding various information, documenting everything
I did and so on. When I'm done I export the report as a PDF and send
it to clients, feedback was always very positive. It's simple but it
makes a difference. I'll mention just one more use case. This winter I
was at
a hackmeeting and someone asked me to talk about video
streaming. It took me about an hour to write an org file on the topic
and I used it directly with Emacs to do a presentation. I did it by
strategically expanding and folding relevant sections as I went over
the topics, and it turned out really well. After the event I exported
it to a few different formats and shared them with participants, once
again I had a complete solution...
29.03.2009 23:01
Publishing with NB and Emacs
Picking an engine to publish my writings I wanted something extremely
simple. First thing that implies is no SQL. I wanted
an engine written in Python
and pyblosxom was
interesting but in the end I went
with NanoBlogger.
NB is a blog engine written in Bash that uses
standard UNIX utils like sed and grep to
create static HTML content. How to write and publish the content is
left as an exercise to the user.
NB can automatically generate templates on new entries or articles,
but it's not perfect when it comes to GNU Emacs. I wanted at
least the correct mode to be started. So I
wrote nbpost.sh,
it creates a new entry, inserts a template and starts the correct
mode. It also recognizes when I'm editing an existing entry, and can
start Emacs if it's not already running. As for the
mode, html-mode is OK, but I
found post-mode
to fit perfectly. It was written for mutt and editing e-mails
but it has other uses too.
Once written and HTML generated, an article needs to be published to
the web server. Doing this manually would be tedious so I
wrote nbsync.py. It
uses rsync for publishing content over SSH. Rsync will
transfer only changes between files, it uses compression and ssh
provides encryption... very simple yet very effective.
With that in place I still wanted better integration of NB in my
environment. I use ZSH which has great completion and a web
search brought me to completion functions written in 2006, a little
outdated but very good. I updated them
and published
_nb here. It completes all the commands as well as categories and
entries.
I now have a complete solution for publishing from Emacs. Which also
brings its related benefits; syntax highlighting, spell checking, well
known key bindings and automatic publishing of content. Not to mention
that org-mode
found it's use too. I keep a journal.org file outlining all
my entries and categories, related TODO tasks and ideas for future
articles.
27.03.2009 19:59
Filesystem encryption on Linux
After months of reviewing different filesystem encryption
implementations for GNU/Linux I settled for two possible
candidates. Those
were: dm-crypt
and eCryptfs. The first
provides a block device encryption layer
while eCryptfs is an actual filesystem - a stacked
cryptographic filesystem to be exact. After another month of
weighing options I decided to use eCryptfs for protecting my
laptop.
Being a stacked FS, eCryptfs mounts on top of an existing
filesystem so it doesn't require a pre-allocated block device. You can
mount it on top of any single directory to protect it. Drawbacks are
that you can't use it to protect you swap partition nor does it
provide plausible deniability - it's obvious that encrypted data
exists. Here is
a nice
table comparing these two implementations. Besides speed and
simplicity eCryptfs is a really clever implementation and it's just
what I need right now.
I used eCryptfs to encrypt my entire $HOME, which is still
kind of a un-documented area. So I decided to write
an
article describing my setup which explains how to use eCryptfs for
$HOME encryption and dm-crypt for protecting swap
space (without breaking hibernation). Next Ubuntu
release will have $HOME encryption with eCryptfs integrated
so it will be interesting to see how they implemented it. By the way,
right now I am more concerned about privacy issues then
security - that's why I didn't encrypt my entire drive, yet. Even if I
did all I could with current solutions I still
wouldn't be at the level of security I really want:
With strong crypto I still want a few other things, most important one
being plausible deniability. Either to have completely hidden
encrypted volumes (Truecrypt hidden volumes can be detected)
or to have different keys unlocking different data. The secret
police should not be able to prove that not everything was
decrypted.
25.03.2009 10:45
Cryptonomicon 10 years later
I bought and read The Baroque
Cycle this winter, and loved it. I avoided it for the longest time
thinking it would be an overkill because I read Stephenson's books
primarily for his SF work. When I finished it I just had to read Cryptonomicon
again.
While reading it I couldn't stop thinking about the technology in the
book. Cryptonomicon was written in 1999, before we had blogs and
Windows 98 was all the rage. Even the Internet as we know it
today was a lot different. But somehow Stephenson pulled it off,
Cryptonomicon 10 years later is not obsolete. You have Finux
and crypto, optics and data havens... Parts of it almost seem like SF,
even today.
Story follows three narrations. Two of them during WW2, and
how allies broke the axis crypto. There people like Turing are side
characters and besides cryptography Stephenson tells us a story of
IT and electronic computers. Narration set in modern
days follows a hacker named Randy - grandson of a
mathematician that worked on breaking the axis code - and his company
Epiphyte while they are trying to build a data haven. In the
process they get involved in a hunt for Japanese war gold, so you also
get your share of adventure... I often saw people calling it a
cypherpunk/cyberpunk bible, and not without good reason, I agree.
22.03.2009 01:37
Takeshi Kovacs novels
I found Altered
Carbon last year in my favorite bookshop, translated and published
on its own. I really enjoyed it, even more so as a cyberpunk
fan. It took me another year to find electronic versions of
other books in Takeshi Kovacs trilogy; Broken Angels
and Woken
Furies, which I read this winter in a period of a few days, or
nights to be more accurate. I started by re-reading Altered
Carbon which, for me, in the end turned out better then the second
book but not from Woken Furies which was a good
finale.
Setting is some 500 years in the future, at which point humans
colonized other planets. Dominant, and most interesting, concept in
these books is that people don't really die anymore, as most of them
have stacks in their spinal columns which store their personalities
and memories. If a body dies the stack can be uploaded to a
new sleeve (body). Well, there is still what they call
real death, destroying the stack (and all backups of it, if
any). That's where our hero, an ex envoy (elite military
unit), Takeshi Kovacs comes in. He is re-sleeved on Earth and
has to solve a murder case. Second book takes place some 30 years
later, where Kovacs is involved in a war on some distant planet... a
classic SciFi novel with interstellar warfare and
aliens. While in the third book he finally returns to his home
planet for a conclusion of a series. We also get to learn a lot
about his early days.
I don't read a lot of SF, apart from cyberpunk novels, but this was
really something. It's a mix of hard-boiled noir detective stories,
cyberpunk and contemporary SF. Something in it for
everyone. Richard
Morgan is an author I can depend on now to tell a really good
story, and his later
work The Black
Man (unrelated to Kovacs novels) confirms it.
21.03.2009 19:55
Pvol and ossaudiodev
My laptop has a lot of extra keys, a few of them for controlling
sound. At first I mapped those to change the volume silently with
amixer. While I was at
a hackmeeting this winter I
noticed a few laptops that had internal OSD showing a
progress bar on volume changes. I liked that, and
recently Gigamo showed me
his rvol
utility for changing the volume that displays a GTK progress bar. It's
written in
Ruby and I didn't have ruby-gtk2 bindings to try it
(nor wanted to install them).
I considered it a good exercise to rewrite it in Python with
pygtk, because so far I used only WxGTK
and PythonCard. Good
thing that I did
as Pylendar
was next and it was much easier to
write. Anyway pvol.py
is a command line utility for changing the volume, showing an optional
GTK progress bar. While rvol uses an external utility for
actual volume changes I decided to use ossaudiodev, so
pvol is standalone. One especially tricky task with it was
muting audio channels. I worked
with pyalsaaudio
before and I like it more but it's not part of the standard Python
distribution. Finally I re-mapped my keys to use pvol and I'm very
happy with it, it's simple but it makes a difference. Let's see what
it actually does:
$ pvol -h Usage: pvol [-s] [-m] [-c PERCENT] [-p] [-q] Options: -h, --help show this help message and exit -s, --status display current volume -m, --mute mute the main audio channel -c PERCENT, --change=PERCENT increase or decrease volume by given percentage -p, --pcm change PCM channel (default is MASTER) -q, --quiet adjust volume without the progressbar
19.03.2009 17:13
Wondershaper
My
LAN is connected to a 4096/256 kbps ADSL line. With so
many machines and a number of people using them to access the Internet
QoS is very important. I found wondershaper some years ago,
and tried with both CBQ and HTB versions and a
number of modifications. Results were OK, but not perfect, I never
managed to achieve the "holy grail" of latency they were
talking about.
Recently I decided to
try HFSC,
and results were much better. What I always wanted to achieve,
and now have
with wshaper.hfsc:
- Low latency for interactive traffic (SSH, DNS and games)
- SSH sessions should never lag.
- ET ping never above 60 for my brother if someone is browsing or there is an active download.
- Skype, Ventrilo and VoIP should be stable
- There should be no interference, has priority over browsing and data transfers.
- Fast web browsing
- It should be fast but it should never hurt the interactive class, and it should stay fast even during file transfers.
- Uploads should not harm downloads
- Avoid large queues on the DSL modem.
- Bit-torrent and other P2P traffic has the lowest priority
- But if some other class is idle it can borrow traffic from it.
12.03.2009 17:13
Vimperator for Emacs users
Vimperator is
a Firefox extension which makes it behave like Vim text editor. It has
similar key bindings and enables fast, keyboard only, web
browsing. For a while there was a similar extension that targeted
Emacs users, conkeror, but then they built a complete browser from
it... and I lost interest. For a while I used LoL extension that provided
hints, and Firemacs extension
which provided Emacs like bindings, it was not bad, at all. But a
recent xf86-video-intel update broke LoL, it would freeze Firefox
while only trying to draw 10+ hints.
In recent months I was reading good things about vimperator almost
every day so I decided to try it. After reading the manual I
wrote a config file which gives me the same experience,
effectively replacing; LoL, Firemacs, It's All Text, AutoHide
Statusbar and Speed Dial extensions on my system (while
providing many new great options). Guideline for writing it was that
any combination hit by mistake does something as close as possible as
it would do if you were in Emacs. Maybe hitting "B
"
is easier to get a buffer list but when you have "C-x
C-b
" burned into your fingertips it's not of much use.
In addition to re-mapping key bindings my options are solid, I decided
to re-use the AwesomeBar functionality and my default search engine is
YubNub, so those give me blazing
fast access to whatever I need, i.e. hitting "C-x l
" and
typing: "aur some package
", or "gim some
image
" ...
11.03.2009 23:09
Desktop calendars
I need a calendar app/widget on my desktop. KDE and GNOME users get
one as a part of their environment. But if you use neither you are
screwed as I recently found out. There are only two options,
rainlendar and osmo. The first is broken with newer
GTK versions for 6 months now and it's not free software (that
could be a showstopper for some I imagine). Other is terribly limited
by GTK, not all buttons/toolbars can be removed, it's huge by default
and can't be scaled to some reasonable size and so on. Both of them
are packed with functionality; notes, agenda, todo, alarms,
birthdays... but I don't need that, I just want a simple calendar
display with basic functions (like switching months and highlighting
days), and there just isn't any.
At first I decided to keep it simple and used xmessage:
$ cal -m | xmessage -file -Then I combined it with some lua code so I can select the month:
function calendar_select(offset) local datespec = os.date("*t") datespec = datespec.year * 12 + datespec.month - 1 + offset datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12) awful.util.spawn("cal -m " .. datespec .. " | xmessage -file -") end -- Then you can call (i.e. on mouse scrolls) calendar_select(0) -- for current month calendar_select(1) -- for next month calendar_select(-1) -- for prev. month... and so onBut it was just too simple, I wanted the current day highlighted, at least. In the end I wrote my own, coded in python and pygtk. I call it PyLendar, it has only two (optional)buttons; Agenda - that calls org-mode agenda (which manages my tasks and projects), and Close that closes it (it also has a default timeout so it can close automatically). After a few days I decided to keep track of non-working days so I implemented that too along with locales. Non-working days are marked bold, and their names are shown in tooltips for the current month. I also implemented month selection on start-up so I can keep using my lua function from awesome, click or a mouse-scroll on my date widget will spawn pylendar in the top right corner of the screen.
10.03.2009 03:57
Anathem by Neal Stephenson
Anathem is a book by Neal
Stephenson, his latest, and for me his best work yet. Although
after reading it again I must say
that Diamond
Age remains my favorite. I recommended Anathem to a few
people and got positive feedback, people love it as much as I
do.
The story is set on another world, where scholars live apart from the
rest of society. They live in concents and spend their whole
lives studying mathematics, physics, mechanics, cosmology... or
whatever makes them happy. This is one of my favorite concepts from
the book. Through their own pursuit of knowledge the reader gets
involved in numerous ideas from these fields. Of course there is a
fair share of adventure, and basically what Stephenson calls
"making a good yarn".
The book has around 1000 pages, as usual with Stephenson, and in the
US it was distributed along with an audio CD, the music is
now available
on-line and it goes rather well with the book. Although you can't
create a playlist, and it was a good exercise to do something about
that, that's a story
for another
article... Since there are numerous ideas and concepts in the book
some
people organized
a wiki for reference, it has some really good content and it's
worth a visit.