Skip to content

Instantly share code, notes, and snippets.

View nsmith's full-sized avatar
🍕
Eat pizza get strong

Nathan Smith nsmith

🍕
Eat pizza get strong
  • Amazon
  • Seattle, WA
View GitHub Profile
@nsmith
nsmith / hammerspoon.lua
Created April 2, 2018 04:11
Hammerspoon Config
local mash = {"cmd", "alt", "ctrl"}
local mashshift = {"cmd", "alt", "shift"}
ext = {}
ext.grid = {}
ext.grid.MARGINX = 5
ext.grid.MARGINY = 5
ext.grid.GRIDWIDTH = 3
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
/usr/bin/etcdctl set /databases/mysql-1 `/usr/bin/docker run --link mysql-1:mysql --rm mysql sh -c 'echo mysql://root:$MYSQL_ENV_MYSQL_ROOT_PASSWORD@$MYSQL_PORT_3306_TCP_ADDR:$MYSQL_PORT_3306_TCP_PORT/wink_hub_api'`
/usr/bin/docker run -i --link mysql-1:mysql --rm mysql sh -c 'exec mysql -u root -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT"' < /home/core/create.sql
/usr/bin/etcdctl set /domains/winkapp <winkapp domain example http://10.0.1.1:3000/hubs/me>
/usr/bin/etcdctl set /agent-ips/agent-1 <public ip example 10.0.1.1>
#!/usr/bin/env node
var fs = require('fs'),
stream = require('stream'),
path = require('path'),
cadence = require('cadence'),
run = require('./monitor/run')
require('cadence')(module, cadence(function (step, options) {
var pems = {}, config = {}, params = {}, useSSL
@nsmith
nsmith / gist:7108680
Created October 22, 2013 21:41
pivot power run 2
2013-10-22 17:40:24 UTC-4: [Status] Device booting
2013-10-22 17:40:24 UTC-4: [Agent] Pivot Power Genius Agent Running
2013-10-22 17:40:24 UTC-4: [Agent] Agent Version: v0.3.2
2013-10-22 17:40:24 UTC-4: [Agent] State::restoreState checking state package for possible state to restore
2013-10-22 17:40:24 UTC-4: [Agent] winkDeviceId = 430
2013-10-22 17:40:24 UTC-4: [Agent] hmacSha1Psk = 59b080e4e2ab2d0535e453f96cef8e4cf3119e68
2013-10-22 17:40:24 UTC-4: [Agent] stateEndpoint = https://winkapi.quirky.com/powerstrips/430
2013-10-22 17:40:24 UTC-4: [Agent] tokenEndpoint = https://winkapi.quirky.com/oauth2/token
2013-10-22 17:40:24 UTC-4: [Agent] accessToken = 06264e2806719ed9306a1e0d56217f70
2013-10-22 17:40:24 UTC-4: [Agent] refreshToken = f55ce8762538131bc3d86b5211353ace
@nsmith
nsmith / gist:7108663
Created October 22, 2013 21:40
pivot power run 1
2013-10-22 17:38:43 UTC-4: [Status] Device booting
2013-10-22 17:38:43 UTC-4: [Device] Bank 1 set to 0.
2013-10-22 17:38:43 UTC-4: [Device] Bank 1 is online.
2013-10-22 17:38:43 UTC-4: [Device] Bank 2 set to 0.
2013-10-22 17:38:43 UTC-4: [Device] Bank 2 is online.
2013-10-22 17:38:43 UTC-4: [Device] Pivot Power Genius
2013-10-22 17:38:43 UTC-4: [Device] Firmware Version: v0.2.2
2013-10-22 17:38:44 UTC-4: [Device] Device ID: 20000c2a69028be9
2013-10-22 17:38:44 UTC-4: [Status] Device configured to be "Pivot Power Genius"
2013-10-22 17:38:44 UTC-4: [Device] Node Registered
mac <- imp.getmacaddress()
impeeid <- hardware.getimpeeid()
agent.send("register", { mac = mac, impeeid = impeeid })
// =FACTORY=AGENT============================================================== //
const projectName = "Pivot Power Genius"
// Factory IMP Device Code
// ---------------------------------------------------------------------------- //
const MAJOR_VER = 0; // Major Version of this Release
const MINOR_VER = 1; // Minor Version of this Release
const RELEASE = 0; // Release Number of this Version
// ---------------------------------------------------------------------------- //
// Revision History
// V0.1.0 - <_G> Initial Release
@nsmith
nsmith / manual_transfer_to_sales_order
Created August 7, 2013 22:06
Sending a 940 from a transfer order
transfer_proc = Elvis::Processes::Outbound::OhlTransfer.new(CONFIG, CONFIG["netsuite"]["ohl_transfers"], {:warehouse_code => "OCP"})
transfer = NetSuite::Records::TransferOrder.get(:internal_id => 1234)
transfer_proc.send_sales_order(transfer)
@nsmith
nsmith / dashboard_post.sh
Created June 17, 2013 13:17
Post data to cloud dashboard
curl -X POST -H "Content-Type: application/json" -d '{
"clock": {
"offset": -14400
},
"gauges": [
{
"label": "EMAIL",
"position": 75.8948
},
{