Skip to content

Instantly share code, notes, and snippets.

View dokku_setup.md

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

View geo_world_map_migration.rb
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'
#
View Rakefile
ssh_user = "user@domain.com" # for rsync deployment
remote_root = "~/path/to/remote/" # for rsync deployment
namespace :styles do
desc "Clear styles"
task :clear do
puts "*** Clearing styles ***"
system "rm -Rfv css/*"
end
desc "Generate styles"
@daz
daz / php-cgi.rb
Created Sep 24, 2011 — forked from ambethia/php-cgi.rb
Homebrew Formula for PHP 5.2.17 as php-cgi (for nginx, etc.)
View php-cgi.rb
# 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'
View gist:4959756
def display_address_title(employee)
if employee.address.empty?
''
else
'<b>Address</b>'
end
end
@daz
daz / go.xero.js
Last active Dec 17, 2015 — forked from ash37/go.xero
View go.xero.js
// 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)
View 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
View Google Apps .zone File
; 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 / build-zsh.sh
Created May 8, 2016
Build last stable version of ZSH from sources on Ubuntu, or any other version with small changes
View build-zsh.sh
#!/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
@daz
daz / FLIR.pm
Created Sep 22, 2017 — forked from novolog/FLIR.pm
Exiftool FLIR.pm
View 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