DHT11 Temperature and humidity sensor

So, I just bought two DHT11 sensors for a small project. From the specifications:

  • Humidity from 20-80% humidity readings with 5% accuracy
  • 0-50°C temperature readings ±2°C accuracy

After wiring them up on my breadboard, I find the following:

  • DHT11 (number one) reports 20% humidity and 20 degrees celsius
  • DHT11 (number two) reports 30% humidity and 24 degrees celsius

    In other words – I got two sensors reporting within accuracy range, but with maximum deviation in both directions.
    I guess I should be pleased – provided both sensors would be placed at the same location, the combined readings would provide me with something very close to reality…

Execute on file change

You have all been there – wanting to execute something whenever a file or a set of files changes. There are several tools that will help you, but so far entr is the simplest, most no-nonsense solution I have found.
I’ve been using it the past few days when creating a dynamic nginx reverse proxy config with consul-template, and it works like a charm.
Go check it out – it is available through apt on ubuntu and brew on OSX.

Semantic versioning, git flow and tags

I have a lot of minor projects that follows the semantic versioning standard. Coupled with git flow this makes my life a little easier. Life can always get easier though, so here is a very rudimentary script for retrieving next version from the latest tag in git:

#!/usr/bin/env ruby
inc = ARGV[0]
version = `git describe --tag $(git rev-list --tags --max-count=1)`
v = Hash[[:major, :minor, :patch].zip(version.split('.'))]
case inc
  when 'major'
    v[:major] = v[:major].to_i + 1
    v[:minor] = 0
    v[:patch] = 0
  when 'minor'
    v[:minor] = v[:minor].to_i + 1
    v[:patch] = 0
  when 'patch'
    v[:patch] = v[:patch].to_i + 1
puts v.values.join('.')

put it somewhere in you path, and call it something like nextver, and the next time you are doing a release, just run

git flow release start $(nextver minor)

No need for checking what the last release was, it is automagically handled:)