Skip to content

Instantly share code, notes, and snippets.

Avatar

Nic Haynes nicinabox

View GitHub Profile
View pi cam.md

Building and tuning a Raspberry Pi security camera

Parts

  • Raspberry Pi (I picked up a new 2B)
  • Camera module
  • Wifi adapter
  • Power adapter (5.1V 2.1A)
  • Micro USB
  • Micro SD card
View gist:a856e2fff59b01caf627
#!/bin/bash
#
# A script to bootstrap dokku.
# It expects to be run on Ubuntu 14.04 via 'sudo'
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source.
# We wrap this whole script in a function, so that we won't execute
# until the entire script is downloaded.
# That's good because it prevents our output overlapping with wget's.
View mount.js
function (view, selector) {
view.setElement(this.$(selector)).render();
}
@nicinabox
nicinabox / osx-for-hackers.sh
Last active Oct 28, 2015 — forked from matthewmueller/osx-for-hackers.sh
OSX for Hackers (Mavericks/Yosemite)
View osx-for-hackers.sh
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
View tokens.txt
MOTOR_OIL
- Change oil, oil filter. 4qt Rotella T6, 0.5 Mobil 1 5W-40
- Change oil, oil filter, air filter, spark plugs
- Oil, oil filter, gearbox oil, rear drive oil, valve adjustment, torque heads
- Change oil and oil filter
- Changed oil and filter
- Changed oil with Castrol GTX 5w-30 and new filter
- New Tensioner - AC Delco (Littens) \nNew O-Ring for Front Crank Sensor\nOil Change (Royal Purple 5w30)
@nicinabox
nicinabox / server.js
Created Apr 12, 2015
A handy server to use in development
View server.js
var connect = require('connect')
var http = require('http')
var serveStatic = require('serve-static')
var PORT = 8000;
var app = connect()
app.use(serveStatic(__dirname + '/public'))
app.use(serveStatic(__dirname))
View makepem
#!/usr/bin/env ruby
class MakePEM
def initialize(argv)
@file = argv[0]
abort help unless valid_args
parts = @file.split('.')
@name = parts.first
@nicinabox
nicinabox / favicon.sh
Last active Oct 24, 2019
Convert favicon.png to an .ico with multiple sizes
View favicon.sh
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
@nicinabox
nicinabox / gist:1a1ba1f846513f30fa4a
Created Dec 9, 2014
Source .env automatically in your projects with RVM
View gist:1a1ba1f846513f30fa4a
# ~/.rvm/hooks/after_cd
if [ -f .env ]; then
source .env
fi
View gist:6b0486bb1ce812806f5d
var _ = require('lodash');
var natural = require('natural'),
classifier = new natural.BayesClassifier();
// First item denotes "changed motor oil"
var notes = [
[true, 'Change oil, oil filter, air filter, spark plugs'],
[true, 'Change oil, oil filter. 4qt Rotella T6, 0.5 Mobil 1 5W-40'],
[false, 'Change gearbox oil, rear drive oil, valve adjustment, torque heads'],
[false, 'Change transmission oil'],