Skip to content

Instantly share code, notes, and snippets.

View nicinabox's full-sized avatar

Nic Haynes nicinabox

View GitHub Profile
#!/bin/bash
# Usage: rolls.sh PATH
for path in $1/**; do
dirname=`basename "$path"`
for file in $path/**; do
exiftool -overwrite_original -headline="roll $dirname" "$file"
done
checkForOuterAction: function checkForOuterAction(event) {
+ if (event.defaultPrevented) return
var isOuterAction = !this.containerEl.contains(event.target) && !this.targetEl.contains(event.target);
if (isOuterAction) this.props.onOuterAction(event);
},
:20000000EDFE0000000000019DAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE
:20002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
:20004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
:20006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
:20008000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
:2000A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF60
:2000C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF40
:2000E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF20
:20010000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
:20012000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDF
const scale = ([domainMin, domainMax], [rangeMin, rangeMax]) => (val) => {
return ((val - domainMin) / (domainMax - domainMin)) * (rangeMax - rangeMin) + rangeMin
}
@nicinabox
nicinabox / roshambo.js
Last active September 23, 2016 01:53
A simple game of rock, paper, scissors
// var rps = new Roshambo(shape)
// console.log(rps.outcome());
(function() {
'use strict';
var Roshambo, random;
random = function (min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
};

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
#!/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.
@nicinabox
nicinabox / gist:8338179
Created January 9, 2014 17:26
Inject respond.js
var node = document.getElementsByTagName("head")[0] || document.body;
if (node)
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = 'https://rawgithub.com/scottjehl/Respond/master/dest/respond.min.js';
node.appendChild(script);
}
@nicinabox
nicinabox / gist:7555799
Last active December 28, 2015 20:09
Setup PlexConnect on unRAID

Clone PlexConnect

git clone https://github.com/iBaa/PlexConnect.git /boot/config/plugins/plexconnect/

Edit /boot/config/go

Move emhttp to a new port. I'm using port 81 here:

/usr/local/sbin/emhttp -p 81 &
@nicinabox
nicinabox / st2.sh
Last active December 28, 2015 08:19
#!/bin/bash
echo -n "Sublime Text 2 or 3? "
read version
echo "Removing file system packages"
rm -r ~/Library/Application\ Support/Sublime\ Text\ $version/Installed\ Packages
rm -r ~/Library/Application\ Support/Sublime\ Text\ $version/Packages
rm -r ~/Library/Application\ Support/Sublime\ Text\ $version/Pristine\ Packages