atomicules

Push propelled program tinkerer and picture maker.

I know some people have no qualms about submitting patches, etc for minor spelling fixes, but there's no way I'm submitting something as simple and as easy (especially because I've probably used bad style). Anyway, Combined with Hugues Moretto's color.patch this makes Sic really nifty from my point of view; I don't use IRC much at all so Sic has all the functionality I need.

I should probably remove PART notices as well.

Discovered via my Pinboard.in tag subscriptions. It's even better than some of the ace Praktica web sites. On a related note, I still have not yet managed any "action" pony shots with my Yashica Mat yet. Ok, the focal length is a bit limiting, but it could be done, it's just the person behind the camera that is the limiting factor at the moment.

Switching from bash to mksh

I stumbled across mention of mksh on the suckless mailing list and because I just cannot help myself with things like this, thought I'd see if I could switch to it from bash. This should be pretty easy for me as it's only fairly recently I'd bothered to get my .bashrc in a proper shape and usuable across platforms so it's not like I'm a power-user of bash; which is also the reason why I never bothered jumping on the zsh bandwagon - the extra functionality would have been lost on me. So pretty much switching for me was never going to require much more than chsh.

There were only three things I wanted:

  1. Vi editing mode. Which it comes with; although is orphaned (i.e. not actively developed). But still works fine for me.
  2. History search up/down in Vi mode. Which is also built it, but took me about ten reads of the man page to spot it (It's / or ? in command mode, type a bit of a command, Enter and then n or N to search back/forward through results).
  3. That fancy Git PS1 thing

Git PS1 in mksh

I tried sourcing git_prompt.sh, but it doesn't work in mksh. I then took a look at the code and thought "that's a lot of script when all I want is the current branch in the prompt" (and also "no way I'm able to convert that to mksh") so did a simpler approach:

$(git branch 2>/dev/null | grep \*; )

since error is redirected to /dev/null if it's not a git directory it displays nothing, if it is it displays the current branch. That's all I need. I don't know if the git_prompt.sh did more than that (I suspect so), but all I ever used it for was to show the current branch (I found it really helped me not do stupid things on the wrong branch). I added a couple of other bits in as well. I wanted to display the current working directory (pwd) because it's quite handy to know where the hell you are it you have a lot of shells open; I don't care however about my username or host:

$(local WD=${PWD/$HOME/~}; if (( ${#WD} > 23 )); then print ${WD:0:10}...${WD: -10: -1}; else print $WD; fi)

I didn't want half my line taken up with the path though, so first the $HOME path is replaced with ~ (WD=${PWD/$HOME/~}) and then if the resultant path is still more than 23 characters long it is trimmed in the middle so I end up with something like: /usr/pkgsr.../mksh/work if I happen to be at /usr/pkgsrc/shells/mksh/work. I figured being able to see a bit of the start and a bit of the end of the path would be better than one or the other.

Last of all I nicked a bit from the mksh man page to display $ or # depending on whether I'm me or root (assuming I get around to using the same shell and .mkshrc for root).

All added together I ended up with:

PS1='$(local WD=${PWD/$HOME/~}; if (( ${#WD} > 23 )); then print ${WD:0:10}...${WD: -10: -1}; else print $WD; fi) $(git branch 2>/dev/null | grep \*; )$(if (( USER_ID )); then print \$; else print \#; fi) '

EDIT (2013-05-08): Fixed the Git branch bit, wasn't clearing after cd'ing to a non-git directory

Because I'll likely never bother to get it in a proper blog post format, I'll just link to the notes I've made whilst switching to NetBSD. When I say switch, I mean replacing my OSX 10.5 PPC "shell account" with a NetBSD i386 XEN one and getting my base install of software up and running:

  • Mutt (Binary package via Pkgsrc works fine for me, need to ensure LC_CTYPE and LC_MESSAGES are set to UTF-8 though)
  • Offlineimap (Pkgsrc binary works fine)
  • Notmuch (Need to do from source. I went for the same version I used under OSX (0.13) as that matches same version requirement for talloc that Pkgsrc provides. Got a bit confused with gmime as could only find older version for awhile in Pkgsrc)
  • TTYtter (No problems, just needed some Perl packages via Pkgsrc for some of the extensions I use)
  • Remind (No problems via Pkgsrc)
  • Vim (Needed to do from Pkgsrc source for Python and Ruby support)
  • PWMan (Built fine! Even including my tweaks)
  • Abook (No problems)
  • Elinks (Built via Pkgsrc source to enable gopher support)
  • Snownews (Is proving a bit fiddly due to Curses display glitches, see the linked notes)
Bluebells

I almost forgot I still had some photos to post. Well, probably just this last one until I get some films shot and sent off this year. Hmmm...

In Lieu of GPG Agent Forwarding

ssh agent forwarding is really neat, and since I've now moved to my "main OS" being remote and "in the cloud" (more on that in another post soon - that's what I've been busy doing this past couple of weeks) it makes a lot more sense than leaving private keys on a remote server; when I was using my Powerbook in the same way, at least I still had physical access to it.

However, as neat and clever as ssh agent forwarding is, I don't really care that much about a private ssh key to Github. I'm much more concerned with my private GPG key being on the same remote machine as the password file it's encrypting.

Unfortunately, GPG Agent forwarding doesn't seem to exist. This is the nearest thing I've found to a solution.

I thought about doing some kind of reverse sshfs mount (Yay for NetBSD, it comes with mount_psshfs built in) so I could have my .gnupg directory symlinked back to my local machine, but it really hurt my head thinking about it and I couldn't get a reverse ssh tunnel to work anyway (probably something to do with my firewall on the NetBSD box - I'm purposefully being restrictive with it, but I do seem to making things difficult for myself as result).

So a quicker, easier way for me to achieve what I want is a little script I can run locally to copy across my GPG key when needed. After copying it across the script pauses and waits for my input so I can do whatever I need with it on the remote side and then as soon as I press return it deletes it. I have it set up as an alias in bash:

alias cpkey="scp ~/.gnupg/secring.gpg remotemachine.com:/home/me/.gnupg/; awk 'BEGIN{getline}'; ssh remotemachine.com rm /home/me/.gnupg/secring.gpg"

The awk 'BEGIN{getline}' is a little trick I found somewhere on the internet as a way of pausing a bash script. On a related note, it should mean it'll work when I eventually figure out switching from bash to mksh (just because).

Bambi

The start of the end for me. A small consolation is that this is proof I've actually managed to use my flash very successfully with my Yashica Mat. Shame it was so long ago I can't remember what settings I used.

Bicycle Tourette's

I realised the other day, that should I pass you on my bike (or you pass me - it has been known to happen) you would probably assume I have Tourette's. "Testicles!" seems to be a favourite one, especially where potholes are concerned.

Earth And Leaves

I'll post this as the last of my Yashica Mat stuff from Italy. I'm not too excited about most of it really, this is ok though.

How much memory is my Tmux session using?

ps -o rss  | awk '{mem += $1} END {print mem/1024 "M"}'

That much.

(Well, assuming you only run one Tmux session and are on OSX 10.5.8, otherwise: something like that).

I'm using a variation on that theme in my Tmux status-bar so that I know how much memory my session is using as well as the overall stats for the machine. This will be quite interesting for me; I'm window shopping and wondering what I could get away with (As I write this I'm using about 100MB).

These are the ten most recent posts, for older posts see the Archive.