MySQL Query with Lowercase Flag

I recently needed to provide an export of string values in a MySQL table that began with a lower case letter.

This query will produce 3 columns: id, name, and lowercase. Rows that begin with a lower case letter will have a 1 in the lowercase column.

SELECT id, name, 
    IF ((BINARY UPPER(SUBSTRING(name, 1, 1 )) = BINARY (SUBSTRING(name, 1, 1))) , "", "1") AS lowercase
  From mytable 
  WHERE name;

Slow PWM for heating liquids with Arduino

I've been preparing to dive into electric home brewing, where the kettles are heated with an electric heating element rather than a gas fire.

The purpose is so I can control the heating element, making it much easier to automate and maintain specific temperatures.

My goal with this exercise was to define a frequency (in milliseconds) and a duty cycle as a percentage (defined as a float, 0.0 to 1.0), then blink an LED to simulate a heating element firing.

Simple AWS Backup/Retention Solution in NodeJS

I needed a tool which would create snapshots and remove them based on a per-volume retention period. There's plenty of scripts out there but I found nothing ideal, so I decided to write a utility from scratch utilizing NodeJS and the aws-sdk module.

I didn't want to maintain config files outside of AWS to define what should be backed up and how long they should be retained. I decided to leverage the AWS resource tagging to define what volumes should be managed with this automated backup management tool.

PostGIS Query for a Point Within a Polygon

I've started digging deep into PostgreSQL and PostGIS for a very geo centric project I'm working on.

PostGIS is an extension that provides geo spatial functionality to PostgreSQL.

Let's say you have a table of neighborhoods, where each record contains an id and a list of coordinates that make up the boundary of each neighborhood.

The following query would return the id of the neighborhood the coordinates -117.289 33.949 exists within.

Proxy Jira 7 Over https with Nginx

I run self-hosted atlassian products and wanted to serve Jira, Stash, and Fisheye on the same server over https.

Users would connect securely to Nginx, and Nginx would proxy Jira locally over standard http. I'm using AWS and the security group (firewall) has all incoming ports locked down except ports 80 and 443.

Java configs & AJAX requests ended up making this a little more complicated than anticipated so I thought I would document the details.

The Goal

Serve the apps at the following addresses:

Why Kalabox V2 Matters to Project Owners

Project Owners?

By project owners, I am referring to individuals such as consultants, team leads, and technology directors. If you make the decision on what goes into the repo, you can spend a little time setting up a Kalabox profile, and your developers have the option to run your application stack as it is intended, with minimal effort, on their OS of choice.

Restify OAUTH Token via Query Parameter

It's probably not a "best practice", but I had a need to support a client sending an OAUTH token via a query string instead of in the request header.

The restify-oauth2 module needs the token to be in an `authorization` header of the request.

I was able to utilize `server.pre` to set the header accordingly if `token=` is detected in the query string.

Configuring SSL Certificates on Rackspace Cloud Load Balancer

There is plenty of information on configuring SSL termination on Rackspace Load Balancers but it might be easy to stumble on setting up the intermediate certificate.

If you have the intermediate certificate configured wrong, you may see a big ugly "untrusted certificate" error in a browser like Firefox.

There are 3 fields to add a certificate to the load balancer: Certificate, Private Key, and Intermediate Certificate.