January 2012
5 posts
4 tags
Asynchronous GNU Readline printing
Some while ago I’ve spend my time developing a XMPP command line client which is using strophe XMPP library to handle XMPP and GNU Readline for I/O.
The idea was to have a readline prompt at the bottom and yet be able to asynchronously print incoming messages above it - in the “log window”.
It seems that many people were looking for solution already:
GNU Readline: how do...
3 tags
Teach your shell how to grab you attention
In my daily work it’s often a case when I have long-running process that I have to wait for to complete and I don’t want to stare at the shell all the time.
To do what I want I’ve created two commands. First is tick that I store under $HOME/bin/tick:
#!/bin/sh
if which mplayer 1>/dev/null ; then
mplayer -quiet -nolirc "$HOME/usr/sounds/tick.ogg" 1>/dev/null...
Add some structure to your home directory.
Personally I find it very useful to keep the same structure on every Unix account I’m using. This is somehow connected with the idea of keeping dot-files in sync between all of them.
I loosely base the structure on Unix root filesystem structure:
~/bin - my handy scripts
~/doc - documents of any kind
~/etc - files keeping settings of ~/bin scripts
~/lab - where I do my programming...
2 tags
Keep you dot-files in sync.
To work efficiently it’s necessary to customize and personalize a lot. After some time one gets used to his customizations and start to depend on them. For example: I map Caps Lock to Escape, as I tend to use vi-mode in any software that supports it and I find Caps Lock key useless anyway. After years of doing so, I simple can not work if Caps Lock is not mapped to Escape. That’s why...
1 tag
Prepend or append to PATH like environment...
In Unix there are quite a lot variables representing path lists of different kind similar to PATH like LD_LIBRARY_PATH, PKG_CONFIG_PATH.
Usual idiom to modify these variables is:
$PATH="$PATH:/new/path/to/something"
I found it quite a lot of typing in a daily work, so I’m using functions shortening the above to just:
append_env PATH /new/path/to/something
The version for Bash...
December 2011
1 post
3 tags
Make tmux and ssh-agent work smoothly.
A lot of people using remote shell accounts must deal with a problem of stale environment variables for ssh-agent.
At each ssh connection, new socket is created and variable $SSH_AUTH_SOCK is set to point to it. The problem is that shells that are already opened can’t have this environmental variable updated automatically. I’ve seen a lot of complex solutions to this (writing some...