jasonwryan.com

Miscellaneous ephemera…

Pinboard Elvis

image

After recovering from the shock of the botched delicious relaunch, I have switched to Pinboard for my bookmarking. Previously, I was just synching my bookmarks from delicious, but now I have abandoned that trainwreck completely.

Two things made the transition painless. The first was the Pinboard Android app so I could access and manage bookmarks from my phone; the second was a little trickier.

As I have previously mentioned, I use bookmarking not just to retrieve my own saved pages, but as a search repository for material that other people have decided is interesting or valuable enough to want to save. And there is no better tool for this sort of searching than Surfraw1

I had written an elvis to search delicious bookmarks, so to complete the transition to Pinboard, I needed to do the same. It was a little trickier than I had anticipated, as some of the URLs (particularly when searching across multiple tags) were reasonably complex given my modest scripting skills. But I got there in the end…

Now searching for web pages that I or anyone else has saved to Pinboard is as simple as typing:

1
pin -t=unix+linux+vim

Which will return all saved pages that share those three tags. I can also refine my search to a particular user with the -u{ser} switch, or just browse recent or popular tags. Simple, but ruthlessly efficient…

Notes
  1. Previous posts on Surfraw:

Delicious? Not after the first bite…

image

I have used delicious, the bookmarking service, for just on five years now and over that time added around 1500 bookmarks. This suggests to me that I am a heavy, but not compulsive boomarker—I tend to only add pages that I think I will have a reasonably good chance of wanting to reference in the future.

I am (or rather, was) an unabashed fan of the service. To the point where earlier this year I wrote a Surfraw elvis to search the site. As this would suggest, I use the site frequently, not just to bookmark or retrieve my own pages, but to search for other pages that people have considered “bookmark-worthy” (which is generally a pretty good indicator of quality).

Like many comitted users, when the news leaked out late last year that Yahoo was shuttering delicious, I jumped to Pinboard and have been synching my bookmarks between the two sites since. In retrospect, that turned out to be an excellent decision.

The “new” delicious was launched overnight and I think it is fair to say that it has been completely and utterly eviscerated. It has gone from being a site that served a very specific (and incredibly useful) purpose—saving and tagging web pages for future use—to a bland, lowest-common-denominator, generic “social” site, like countless others that have arrived and disappeared with quirky names like Plurk, Plonker, etc..

The site looks good; all light and airy and spacious (that space will, I am sure, be quickly filled with advertising), but they have stripped all the utility from the site. You can no longer actually access and manage your bookmarks. It is a colossal failure.

I have 757 tags. I know that tag clouds are considered old hat, but on a site built on taxonomies, they are still an incredibly effective way of presenting information. The new delicious has dispensed with them. They have also decided that I don’t need to see all of my tags, so I can now only view 50 of them. Fifty out of seven hundred and fifty. Presumably I am expected to guess all the rest…

image

The new tag display on the left and the old, as a cloud, on the right.

These aren’t options, though. All of the settings to display tags, tag bundles, etc., and the options to edit tags have been removed. You can’t access any of the tools to manage your bookmarks. The designers have decreed that you can no longer manage your information in a useful way. Morons.

The clueless mediocrities responsible for this will probably think that they are reinventing the site and making it relevant for a broader, less geeky market. And they are probably right. The fact that the site looks remarkably like a phone app suggests that sort of studied rush to the bottom.

What they have done is something of an achievement on one level, though. They have made Yahoo look good. In all the time that Yahoo owned delicious, they were only able to neglect it; these new clowns have completely fscked it…

If you bookmark sites because you are semi-intelligent and you recognize that being able to easily access and manage information effectively is critical to your intellectual and social wellbeing, then head over to Pinboard and sign up now.

tmux & SSH Keys

image

I have posted before about tmux1, the terminal multiplexer. One of the (minor) frustrations that I have to-date done nothing about was setting up persistent SSH key management across sessions. The ability to enter the passphrase for my public keys once, and then to be able to access remote hosts—or {git,hg} push—without having to re-enter a passphrase.

My solution is quite hackish, but it works and, given the only other solutions I was able to find by searching seem even more convoluted, I thought I would share it.

There are a couple of separate steps, none of them of any real consequence, but each necessary.

First, in your $HOME/.tmux.conf you need to enable update-environment:

1
2
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK
SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"

From the man page:

Set a space-separated string containing a list of environment variables to be copied into the session environment when a new session is created or an existing session is attached. Any variables that do not exist in the source environment are set to be removed from the session environment (as if -r was given to the set-environment command).

The next step is to create a script (mine is bound to a key sequence to launch from scratch, you can adopt a simpler approach) that starts tmux and initializes ssh-agent:2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
PID=$(pgrep tmux)
new="tmux -f $HOME/.tmux/conf new -s secured"
old="tmux attach -t secured -d"

if [[ -z "$SSH_AUTH_SOCK" ]]; then
    eval `ssh-agent`
    trap "kill $SSH_AGENT_PID" 0
fi

if [[ -z "$PID" ]]; then
    urxvtc -title "SSH" -e sh -c "${new}"
else
    urxvtc -title "SSH" -e sh -c "${old}"
fi

ssh-add

The final step is to install keychain, and set it up. I followed the instructions on the Arch Wiki and opted for a couple of lines in $HOME/.bash_profile3, like so:

1
2
3
/usr/bin/keychain -Q -q --nogui ~/.ssh/id_rsa
[[ -f $HOME/.keychain/$HOSTNAME-sh ]] &&
    source $HOME/.keychain/$HOSTNAME-sh

That’s it. Now, hitting a key sequence opens a terminal, I am prompted for my passphrase and then, if I open another window, or another tmux session as long is the first session is still running, attached or not, I am authenticated and can SSH or push without a prompt.

Updated 7/10/11

I refined the sequence to provide me a little more flexibility: now the keychain is only called if I start a specific named tmux session. To do this, I changed my $HOME/.bash_profile to test for that session:

1
2
3
4
5
6
7
8
tsess=$(tmux ls)

if [[ "${tsess%%:*}" = "secured" ]] &&
   [[ -f $HOME/.keychain/$HOSTNAME-sh ]]; then
    # start keychain
    /usr/bin/keychain -Q -q --nogui ~/.ssh/id_rsa
    . $HOME/.keychain/$HOSTNAME-sh
fi
Notes
  1. Previous posts:

  2. Updated to include session test.

  3. Alternatively, placing the script in /etc/profile.d/keychain.sh will start the agent when you login, as opposed to starting a specific shell. Your call on security versus convenience…

Creative Commons image from mer de glace