Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mckeed on github.
  • I am mckeed (https://keybase.io/mckeed) on keybase.
  • I have a public key whose fingerprint is C586 8290 56ED AE14 3C01 04ED 41E1 CC39 AA4E D6B6

To claim this, I am signing this object:

@mckeed
mckeed / intermatic-switch
Created August 1, 2014 01:19
Intermatic Switch SmartThings Device Type
metadata {
// Automatically generated. Make future change here.
definition (name: "Intermatic Switch", namespace: "mckeed", author: "Duncan") {
capability "Actuator"
capability "Switch"
capability "Refresh"
capability "Sensor"
fingerprint inClusters: "0x25"
}
javascript:document.getElementsByTagName("tbody")[0].deleteRow(-1);document.getElementsByTagName("tbody")[0].deleteRow(0)
@mckeed
mckeed / post-merge
Created June 8, 2012 20:05
A useful post-merge git hook for Rails projects. Automatically runs bundle install and rake db:migrate. Put it in .git/hooks
#!/bin/bash
if [ ! -z `git diff --name-only HEAD@{1}..HEAD Gemfile` ]
then
echo -e "\033[0;31m*** Gemfile change detected, running bundle install ***\033[0m"
bundle install
fi
if [ ! -z `git diff --name-only HEAD@{1}..HEAD db/migrate` ]
then
@mckeed
mckeed / encrypto
Created October 15, 2015 15:45
Shell script for easy encrypting of folders using keybase (I'm not a shell script master so let me know if there's errors)
if [ -d "$2" ]; then
( set -x
tar -cz "$2" | keybase encrypt -bs $1 -o "$2".tgz.gpg
)
elif [ -f "$2" ]; then
( set -x
keybase encrypt -bs $1 $2
)
else
echo "Usage: encrypto keybaseuser path"
@mckeed
mckeed / dark_sky_growler.rb
Created April 21, 2013 20:07
My script to use the DarkSky API to tell me when it's going to start raining in the next hour. When I bike to work, I run this on a launchd job every 10 minutes from 4:00-6:00.
#! /usr/bin/env ruby
# encoding: UTF-8
require 'rubygems'
require 'active_support/core_ext'
require 'rest_client'
require 'json' unless defined?(JSON)
require 'growl'
API_KEY = ENV["DARKSKY_API_KEY"]
@mckeed
mckeed / telscan
Last active December 18, 2015 00:49
Script that uses nmap to look for local devices that respond to broadcast ping and have open telnet ports
#!/usr/bin/env ruby
# Looks for local devices that respond to broadcast ping and have open telnet ports
`ifconfig`.scan(/broadcast ([\d.]+)/) do |b,|
next unless b[/^(192|10)\./]
puts "Scanning #{b.gsub(/255/, '*')}"
`ping -c2 #{b}`.scan(/from ([\d.]+)/).uniq.sort_by {|a,|
a.split('.').map {|p| p.to_i }
}.each do |a,|
@mckeed
mckeed / mode-button.groovy
Created January 16, 2014 05:00
Mode Button SmartApp to change modes or turn on/off lights from Aeon remote controls.
preferences {
section("When I push a button on this remote") {
input "button", "capability.button", title: "Device"
input "whichButton", "number", defaultValue:1, title: "Which button"
}
section ("When I push the button") {
input "pushMode", "mode", title: "Change mode to", required: false
input "switchOn", "capability.switch", title: "Turn on switches", required: false, multiple: true
input "switchOff", "capability.switch", title: "Turn off switches", required: false, multiple: true
}
@mckeed
mckeed / toggle-button
Created January 16, 2014 05:03
Toggle Button SmartApp to toggle a switch when you press a button on an Aeon remote control.
preferences {
section("When I push a button on this remote") {
input "button", "capability.button", title: "Button"
}
section("Which button:") {
input "whichButton", "number", defaultValue:1
}
section("Toggle these switches") {
input "switches", "capability.switch", multiple: true, required: false
}
@mckeed
mckeed / aeon-multisensor-6.groovy
Last active May 15, 2016 19:06
Aeon Labs Multisensor 6 device handler
/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License