Chad Stovern


Christian. Husband. Dad. Geek.

How To Send Email through an External SMTP Service with Sendmail on FreeBSD 10.1

One of the most common needs when setting up a new web server is sending email. The safest and easiest way to do this is to connect your server to a mailing service such as SendGrid or Amazon SES. Using an external service will help you avoid pitfalls like your server IP getting blacklisted by anti-spam services.

I’ve written a full tutorial over at DigitalOcean covering exactly how you set this up on your FreeBSD droplet.

If you're new to FreeBSD, some of what we do may look a little scary, but you'll soon be comfortable rolling up your sleeves to do a little recompiling of system tools like the FreeBSD pros.

Check out the full tutorial here: How To Send Email through an External SMTP Service with Sendmail on FreeBSD 10.1


Build a $20 Standing Desk in 20 Minutes

After nearly a decade of working jobs doing geek stuff sitting in front of a computer all day, I started developing lower back pain. Even being active off hours wasn't enough, so I caved and talked my boss into a GeekDesk v3.

However, now that I've moved on and am part of a small startup team working from my home office, that's just not a purchase I was ready to justify again. Nine months into my new adventure with iDoneThis and my enthusiasm is high, yet my back is killing me…

Colin, the founder of Customer.io, has an awesome and famous post about his $22 standing desk. This is truly a creative gem, that I really wanted to set up for myself.

My problem was that my desk has a raised monitor area. I would either have to remove part of the desk or hack off half of the back legs of the table in Colin's solution. :-(

Desk Sitting

I thought about finding or building a couple simple boxes as the dimensions I would need for the monitor section of my desk and the work surface were roughly the same.

After searching around for those dimensions I found this stackable shelf unit (11.63" H x 24.13" W x 11.63" D and holds up to 20 pounds) at Target. The total cost with tax and shipping was only $19.84 ( due to a 10% off coupon code + free in store pickup).

Once I brought the shelves home, it took me all of 20 minutes to clear my desk, assemble them, and set my gear back up. I've been standing for a week now and once again my back pain has subsided.

Desk Standing


Setting Up PostgreSQL on OS X Yosemite for Local Development

First and foremost, I highly recommend that you download VirtualBox and Vagrant to bootstrap a development server on your Mac.

That being said there are times when you're doing a simple test or tutorial and you'd like to be able to run PostgreSQL on your local machine.

I'm writing this as I found setting this up on OS X 10.10 Yosemite to be a bit of a pain, since a simple homebrew install didn't do the trick for me.

Caution: Before going any further, this tutorial assumes you do not have a prior installation that has data you actually want to keep. If this is not the case then stop now, and backup your data to restore later.

Fire Up That Command Line, It's Time to Dive In.

This is not a production environment and chances are this is a Mac that you alone use. Therefore it's perfectly acceptable to optimize for simplicity and ease of use.

If you've never installed PostgreSQL in the past (if you have skip ahead one step), then create the data directory you need and set the permissions so your user account has full access.

mkdir /usr/local/var/postgres
chmod 770 /usr/local/var/postgres

If you've installed PostgreSQL before (if you haven't you should follow the first step and skip this one) and do not have data you care about, follow these steps to setup your data directory with full access for your user account.
If the first command produces an error just ignore it, you're making sure PostgreSQL isn't loaded already and trying to run before you have things setup correctly.

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
sudo rm -rf /usr/local/var/postgres
mkdir /usr/local/var/postgres
chmod 770 /usr/local/var/postgres

Now install PostgreSQL using [homebrew][]. If you already have it or an old build just uninstall that first. (hint: brew uninstall postgresql)

brew install postgresql

Next initialize the data directory.

initdb -D /usr/local/var/postgres

After the initialization is complete, setup PostgreSQL to run on boot with these two commands. The first creates a symlink to a launch agent and the second tells launchctl that that agent would be loaded now and on boot.

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

PostgreSQL will now start up and be ready to use. One trick is to run the createdb command with no arguments to create a database named after your user account. You never have to do anything with this database, but this allows you to run the psql command unadorned to connect to PostgreSQL.

TL;DR
Do this now and save keystrokes later.

createdb

Now you can connect to your locally running PostgreSQL server just by running this short command.

psql

You're now ready to create a database or two for your projects to use and start hacking. Have fun! :-)


What you should be doing even when you don’t want to

Brett Terpstra's interview with Rory Vaden was a gold mine, I highly recommend a listen.

Here are a couple pull quotes in no particular order that I thought were nothing other than amazing:

Successful people and top performers at some point learn to do the things they should be doing even when they don't feel like doing them.

This is very true. Many of the people that inspire me, are great at this, and it's really hard to be great at doing things you just don't feel like doing.

Procrastination and indulgence are nothing more than creditors that charge you interest.

Relating procrastination to personal finance really resonates with me. "I'll do it later" just leaves you feeling behind and you can't catch up. Taking care of priorities before fun is one of the smartest things you can do.

The paradox principle of sacrifice:

  • Easy short term choices lead to difficult long term consequences.
  • Difficult short term choices lead to easy long term consequences.
It's really easy to eat a cookie and grab more coffee than to go for a run and drink plenty of water each day. :-P