Displaying the current repo in your prompt

I tend to nest repos a lot in my usual workflow (The common elements are generally ~/code/ext/[repo], but with the pull_ext infrastructure I wrote, >5 levels of nesting are not uncommon).

To work around this, I wanted my prompt to hilight the root of the current repository and also tell me what type of repo it is.

vcs_info does this, but I find the configuration quite inflexible, and some of the tests are quite expensive so I decided to quickly hack something together.

I arrived at

Which recurses back from the current directory, looks for the metadata for the 4 VCS systems that I use, and exports a character for my prompt and for the colored PWD.

Then I only run this on directory changes to keep things quick (Which does mean that `git init .` won’t update the prompt until you shuffle about a bit.

The net result is this

repo aware prompt

Posted in Articles | Tagged , , | Leave a comment

Openbox gets a faux-Divvy mode

Openbox

For some time now I’ve used openbox as my WM of choice (I worked it out the other day, it’s about a year since I migrated) and apart from needing to add one feature, it meets my needs pretty perfectly.

Divvy

One thing I did learn during the epic OSX wager though, was that divvy is a cool idea. Having the idea to quickly snap windows to segmented regions of your display can be a boon for people sitting between the floating and tiling models. I did feel that the Divvy implementation was a bit clumsy though, which meant I should…..

Them codes

This creates a set of bindings rooted off a modifier key (I used Windows+Escape because it’s a natural shape for my hands but far away from something I can hit by accident) and then used the nethack vi bindings because they’re drilled deep into my brain.

You’ll also see the `Warp` action attached to all of them.. if you’re not running my fork (which is still unmerged upstream, my fault) you’ll want to remove them unless you want to hear openbox be /very/ noisy about it.

From this you can do `W-Esc l` to place the current window on the right 50% of your screeen, `W-Esc y` for the top left, etc.

I think implemented modifiers, Shift for 66% and Ctrl for 34% for balanced splits. Tiling window managers (and even tmux, via the `next-layout` and `previous-layout` commands) support these, but I still need floating window support for the most part.

Posted in Articles | Tagged , , , | Leave a comment

psych0tik mirrors raspberry pi

Anyone who’s spoken to me in person knows that I’m really excited about the upcoming release of Raspberry PI.

I’ll keep the speil to a minimum, but a $35 ARM SoC with ethernet, USB and enough hardware onboard to decode 1080p video on 1 watt.. you can see why I’m pretty stoked.

Recently, there was a call for mirrors and psych0tik raised our hands, we’re mirroring any and all content (presently, debian 6 iso’s) needed to get your pi up and running, though unfortunately only for those of you with ipv6 access at this stage.

Point your (ip6 capable) browser at alura.psych0tik.net/rpi to get the images!

EDIT: For anyone having issues with their system giving preference to A records, I have removed the A record from alura.psych0.tk

Posted in psych0tik News | Tagged , , , | Leave a comment

Git stashing, and why you do it too much

First of all, this workflow depends entirely on an (rarely un)spoken rule in my repositories- if it’s in the wip/ or trash/ tree, don’t touch it. I’m planning on rebasing with impunity.
I stash a lot at work, especially when I shouldn’t.

Generally, stashing occurs when I’m working on something that’s not ready for production or even feature complete enough to warrant publishing, and I need to rebase or start on something else. Nearly always I stash it and forget about it (even though my prompt yells at me when I have stashes)

The alternative is to check it into a wip/ or trash/ branch (depending on how confident I feel about the change in question being a Good Idea). This is useful for a stack of reasons:

  1. It preserves some history about the idea (what else I was doing at the same time)
  2. It makes tracking what you’re doing a lot simpler (because the stash stack is a pain at the best of times)
  3. Most importantly, you can keep branching

The last one is the most relevant, a stash isn’t rooted to any particular point on the tree which means if you make an invasive change you’re going to struggle (which is a pain when the patch in question alters some core behaviour and was only barely working to start with)

If I know it’s going to be a problem that I take a lot of stabs at I’ll generally make it a branch like wip/ideas/short_description_of_approach for simplicity to begin with; and this will only get better in git 1.7.9 which adds a description attribute for branches.

Stashes are awesome for getting a clean tree so you can rebase or do some non-trivial merging, but for keeping ideas straight it’s a pain; to the point where I’m considering a hook to delete my stashes after a week so that I can just be rid of them.

Posted in Articles | Tagged , , , | 2 Comments

Convert iterm color file to Xdefaults

My favourite colorscheme for vim (Jellybeans.vim recently had a pull request submitted including a colorscheme for iTerm2, a terminal emulator for OSX.

Not wanting to go back to OSX after finally getting my encryption key back and being back in linux, I set about converting it to RGB values that urxvt can understand.

I realised two things while doing this-

1. plists are flaming piles of horror. Someone at Apple took bad acid.
2. Ruby is cool for bashing up quick scripts.

The results are up on github as itermcolors2xdefaults and it seems to work reasonably well.

The scheme in question was very feint so I added an option to multiply all the colors, but by and large it does what it says on the tin.

Posted in Articles | Tagged , , | Leave a comment

~/.subversion in svn

I have to do this way more often than I’d like, my home directory lives in svn, and my svn config comprises part of my home directory. The upshot is that subversion likes to make blank data if none already exists, and then falls in a heap if the path it’s trying to create is already there.

This gets worse if you already have config you like and goes totally sideways if you actually depend upon some of it to get a clean checkout.

The solutions isn’t complex- but isn’t obvious either. Most solutions I’ve seen involved invoking svn, then trying to throw it in the background after it creates metadata but BEFORE it begins creating files, and then nuke the files. Kludgy at best- I much prefer this approach.

#!/bin/sh
cd ~
mv .subversion _subversion
svn --config-dir _subversion up
echo "You must now merge _subversion into .subversion"

Posted in Guides, Hax | Tagged , , | Leave a comment