Sharing Links May 28th, 2010

Sometimes I make a tool that I use for a while and then wonder if it’s something others will find useful too. Here’s one of them…

For a while I was sharing links on my home page by linking to the feed of stories I’ve upvoted on Reddit, but that has become less satisfying as Reddit dumbs itself down each day (the same thing that happened to Digg a few years earlier). I decided to make my own link-sharing program that I could use by just clicking a bookmarklet whenever I was on a page I wanted to share.

It is a very simple program that stores the links in a flat text file and uses CORS to allow the bookmarklet to POST data to it from across domains. You can put the files in a directory on your server and use this simple bookmarklet to share links:

Drag this to your bookmarks toolbar: Share This

You can check out the server code or the bookmarklet source, or you can download the zip archive and extract the files on your server.

When you fetch the server script with GET you get back a JSON or RSS feed depending on the format parameter you pass.

Make sure the password in the bookmarklet stays synced with the password in the server file and change them to something secure.

Removing file extensions with sed May 12th, 2010

I need the following sed one-liner periodically, and I thought it was useful enough to share here. Other versions I’ve seen chopped off everything after the first dot, which doesn’t work for files with a dot in the basename. This one does:

sed s/\.[^\.]*$//

Sample Usage:

bsterne@zodiac:~$ ls /video | sed s/\.[^\.]*$// | head -n5
2001: A Space Odyssey
40 Year Old Virgin, The
9
A Bronx Tale
A Clockwork Orange


Wildflower Triathlon 2010 May 4th, 2010

I completed my first triathlon this weekend! I raced in Sunday’s Wildflower Olympic Distance Triathlon and placed 85th out of 224 in my age group. I was very happy with my performance and met or exceeded all my goals for the race.

It was an awesome experience all the way around. The environment is fun and festive with live music and food and race equipment vendors, all the athletes and volunteers are super supportive of each other, and the rush of finally getting to the finish line was indescribable. I’m hooked, for sure.

WordPress and Content Security Policy April 12th, 2010

Lately, I have been implementing the server logic for Content Security Policy in WordPress. I was very pleased to see that the WordPress community opened up the tracking bug for this feature around the time we first blogged about it. One of the neat things about working for Mozilla is that contributions to other important open source projects are treated as valid, valuable uses of our time.

Today, I posted my first patch to WordPress, still a work in progress, which adds an administration panel (see below) for configuring CSP. One of the features I’m rather happy with is “Suggest Policy”, which analyzes the content in the user’s blog and recommends a policy based on the content types and sources it finds.

Next I’ll be working on moving the remaining inline script into external script files. Stay tuned for further updates!

Growing Veggies at Home April 10th, 2010

Update: 2010-06-20

The planters are doing great so far. I love how the squash and zucchini put up the giant sun catching leaves and send the vines bubbling over and onto the ground.

In progress...

Last year, I built some sub-irrigated planters (SIP) using the excellent 2-bucket design from Green Roof Growers. The concept is based on the commercial product, Earthbox, but costs far less to build at home. The basic idea is that the plants wick up just the right amount of water from the reservoir underneath. The design includes drainage holes at the top of the reservoir that prevent over watering, so it’s really easy to keep keep plants happy using this system. They really seem to thrive when they can drop their roots down through the screen and into the water below.

Completed planter

Last year we had cherry tomatoes and some mixed greens, which were delicious but seemed to really attract a lot of aphids. This year I added a third SIP and we’ve planted heirloom tomatoes and cucumbers:

Tomatoes and cucumbers

…as well as some snap peas that are doing really well so far:

Snap peas

I also built the wooden boxes the planters are sitting in to give them a nicer aesthetic and to protect them from the sun. This project has been really fun and is part of a larger effort on my part to make things myself.

A-Star (A*) Algorithm in Python – Update January 25th, 2010

Since there have been many requests over the years for the source code referenced in my A-Star (A*) Algorithm post, I decided to share it. I did a bit of refactoring too, as I have learned some neat things about Python in the years since I wrote that post, like list comprehensions.

A cautionary note to undergrad CS students (who I can only assume are the requestors): CS professors are pretty good at catching cheaters, so learn from others’ code, but write your own.

Source: astar.py

East Bay Psychotherapist
Licensed Clinical Social Worker provides psychotherapy and counseling services for couples and individuals in the East Bay Area.