Removing a passphrase from an OpenSSH pub key

I’d set a passphrase on an OpenSSH key that I use to connect to a git repo on my local server. It started to get annoying, and more annoying with any other tool that I tried to use with the same key as it’s seems not all tools are setup to handle the prompting for the keyphrase.

Quickest workaround: remove the passphrase with ‘ssh-keygen -p’

– when prompted give the name of the pub/priv keypair (eg id_rsa), give the current keyphrase, and then when prompted for the new keyphrase, just hit return and again to confirm.

Cygwin, git and ssh: ‘cannot spawn c:cygwinbinssh’

Using Cygwin and git on windows, I ran into an issue where git was working fine in a cygwin shell, but I was trying to setup a Jenkins build accessing a git repo, and git from Windows was giving errors like this:

$ git push myremote master
error: cannot spawn c:cygwinbinssh: No such file or directory
fatal: unable to fork

Running shell commands on Windows in Cygwin this was somewhat misleading, as I wasn’t expecting it to be looking for ‘ssh.exe’.

Turns out my GIT_SSH env var was causing the issue, had to replace this:

GIT_SSH=c:cygwinbinssh

with

GIT_SSH=c:cygwinbinssh.exe

and then all was good.

Using Spring 3.1 Profiles

Profiles in Spring 3.1+ give you the ability to define conditional bean configurations based on a profile name, where one of your defined profiles is selected at runtime based on a selected profile name.

For example, if you have certain beans that are needed for running in a certain deployment environment but not needed for others (dev, test or prod), or if certain beans need to be configured differently between different environments, Profiles give you the ability to do exactly this.

If you’re using XML configuration, you use the profile=”…” attribute on the
<beans> element. For example:

<beans>
    <beans profile="dev">
        ... bean defs for dev profile here
    </beans>

    <beans profile="prod">
        ... bean defs for prod profile here
    </beans>
</beans>

To select your profile at runtime you’ve got a couple of different options – the easiest approach is to declare a system property, or -D parameter to your JVM at startup:

-Dspring.profiles.active=dev

When you initialize your Application Context, Spring automatically checks for this property and then will initialize only the beans declared for that specific profile. Beans not within a profile will still get initialized, or alternatively a profile with the name ‘default’ will get initialized if no other profile is specified.

Another approach if you need more control over the logic to determine which profile is active on startup, you can programmatically select your profile like this:

GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();

if( ... some logic here)
{
    ctx.getEnvironment().setActiveProfiles("example_profile_1");
}
else
{
    ctx.getEnvironment().setActiveProfiles("example_profile_2");
}

ctx.load("classpath:applicationContext.xml");
ctx.refresh();

Notice with this approach, since we’re not using the spring.profiles.active property, we don’t want to load the context xml file until after we’re determined programmatically which profile is active (based on some logic), then we set the profile with setActiveProfiles(), then load the xml, and refresh the context to initialize our beans for the selected profile.

Installing XBMC media center on a HP Mini netbook

I’ve been setting up XBMC media center on an old HP Mini netbook as an experiment to listen to streaming radio via my home theatre setup. I started initially with the XBMCbuntu iso since it was the easiest to setup, but the Ubuntu side of this distro was too slimmed down for my liking. It didn’t come with drivers for the wifi card out of the box, so while I was planning on connecting via ethernet close to my home theatre setup, I still wanted to pickup the netbook and use wifi while working on setting it up.

So my next attempt I went for a full Ubuntu 12.10 desktop install (wifi drivers included), and then followed the manual steps to install XMBC next.

My main interest in XMBC is the Radio Add-on that has a menu of selectable streaming radio stations. My next interest is being able to control the radio selection remotely, either via a web interface or via an Android app. All the web interfaces, including the default interface, don’t seem to let you browse the Radio add-on. I’ve found one Android XMBC remote that does, so this one does what I need:

https://play.google.com/store/apps/details?id=ch.berard.xbmcremotebeta

My next interest is running Spotify on the netbook and also controlling it remotely. Two choices here, either

  • Use a Spotify Add on for XBMC, like Spotimc
  • Or install the Spotify for Linux client, and then use one of the many Spotify remote apps to control it directly

Given that I haven’t had much luck with XBMC remotes controlling XBMC add-ons, I’m going to try a separate Spotify install and then try out one of the remote apps, like this one: Spotcommander. I’ll post an update once I’ve got these installed and configured.