Skip to content

Instantly share code, notes, and snippets.

@daz
daz / FLIR.pm
Created September 22, 2017 08:38 — forked from mauricebaruk/FLIR.pm
Exiftool FLIR.pm
#------------------------------------------------------------------------------
# File: FLIR.pm
#
# Description: Read FLIR meta information
#
# Revisions: 2013/03/28 - P. Harvey Created
#
# References: 1) http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4898.0.html
# 2) http://www.nuage.ch/site/flir-i7-some-analysis/
# 3) http://www.workswell.cz/manuals/flir/hardware/A3xx_and_A6xx_models/Streaming_format_ThermoVision.pdf
@daz
daz / build-zsh.sh
Created May 8, 2016 10:44
Build last stable version of ZSH from sources on Ubuntu, or any other version with small changes
#!/bin/bash
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Make script gives up on any error
set -e
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo checkinstall
class CreatePlaces < ActiveRecord::Migration
# Rails migration for GeoWorldMap db into postgresql db
# (inspired by http://blog.inspired.no/populate-your-database-with-free-world-cities-countries-regions-in-2-minutes-using-a-rails-migration-273/ post)
# extract files from GeoWorldMap.zip archive from here
# http://www.geobytes.com/GeoWorldMap.zip
#
# and place them into #{Rails.root}/db/migrate/
# the archive has 'cities.txt' file, rename it 'Cities.txt'
#

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

; CNAME
calendar 1 IN CNAME ghs.googlehosted.com
drive 1 IN CNAME ghs.googlehosted.com
mail 1 IN CNAME ghs.googlehosted.com
sites 1 IN CNAME ghs.googlehosted.com
video 1 IN CNAME ghs.googlehosted.com
; MX
@ 1 IN MX 10 aspmx3.googlemail.com
@ 1 IN MX 1 aspmx.l.google.com
@daz
daz / user.rb
Last active December 18, 2015 01:29 — forked from matthewlehner/user.rb
# Because we have some old legacy users in the database, we need to
# override #has_secure_passwords' method for checking if a password is valid.
# We first ask if the password is valid, and if it throws an InvalidHash
# exception, we know that we're dealing with a legacy user, so we check the
# password against the SHA1 algorithm that was used to hash the password in
# the old database.
#SOURCES OF SOLUTION:
# http://stackoverflow.com/questions/6113375/converting-existing-password-hash-to-devise
# https://github.com/binarylogic/authlogic/blob/master/lib/authlogic/crypto_providers/sha512.rb
@daz
daz / go.xero.js
Last active December 17, 2015 22:38 — forked from ash37/go.xero
// keymaster.js
// (c) 2011-2012 Thomas Fuchs
// keymaster.js may be freely distributed under the MIT license.
(function(e){function f(e,t){var n=e.length;while(n--)if(e[n]===t)return n;return-1}function l(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h(e){for(t in r)r[t]=e[c[t]]}function p(e,t){var i,o,u,l,c;i=e.keyCode,f(a,i)==-1&&a.push(i);if(i==93||i==224)i=91;if(i in r){r[i]=!0;for(u in s)s[u]==i&&(m[u]=!0);return}h(e);if(!m.filter.call(this,e))return;if(!(i in n))return;for(l=0;l<n[i].length;l++){o=n[i][l];if(o.scope==t||o.scope=="all"){c=o.mods.length>0;for(u in r)if(!r[u]&&f(o.mods,+u)>-1||r[u]&&f(o.mods,+u)==-1)c=!1;(o.mods.length==0&&!r[16]&&!r[18]&&!r[17]&&!r[91]||c)&&o.method(e,o)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}}function d(e){var t=e.keyCode,n,i=f(a,t);i>=0&&a.splice(i,1);if(t==93||t==224)t=91;if(t in r){r[t]=!1;for(n in s)
@daz
daz / gist:4959756
Last active December 13, 2015 18:59 — forked from ash37/gist:4959753
def display_address_title(employee)
if employee.address.empty?
''
else
'<b>Address</b>'
end
end
@daz
daz / style.scss
Last active May 13, 2023 11:24 — forked from kevindavis/gist:1868651
Bootstrap styling for jQuery UI autocomplete
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@daz
daz / php-cgi.rb
Created September 24, 2011 09:33 — forked from ambethia/php-cgi.rb
Homebrew Formula for PHP 5.2.17 as php-cgi (for nginx, etc.)
# Homebrew Formula for PHP 5.2.17 as php-cgi (for nginx, etc.)
require 'formula'
class PhpCgi <Formula
@url='http://www.php.net/get/php-5.2.17.tar.bz2/from/a/mirror'
@version='5.2.17'
@homepage='http://php.net/'
@md5='575551f5df56b9311e932b3a098c2e7a'