Skip to content

Instantly share code, notes, and snippets.

blueprint:
name: Moisture Sensor
description: Perform action when moisture sensor turns wet
domain: automation
input:
actions:
name: Actions
description: Notifications or similar to be run.
{{ trigger.event.data.new_state.attributes.friendly_name }} will be the name of the
sensor
@hatchetation
hatchetation / build_pixelpulse2.md
Last active August 29, 2015 14:18
Building pixelpulse2 for OS X

Building Pixelpulse2

OS X

Prerequisites

  1. Install Qt 5.4 https://www.qt.io/download-open-source/
  2. Install libusb: brew install --build-from-source libusb
  3. Get qt in your path: export PATH="${HOME}/Qt/5.4/clang_64/bin:${PATH}"
@hatchetation
hatchetation / fs-flavors.txt
Created September 27, 2014 02:22
rackspace flavors
$ nova flavor-list
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+------------------+-------------------------+-----------+------+-----------+------+-------+-------------+-----------+
| 2 | 512MB Standard Instance | 512 | 20 | 0 | 512 | 1 | 80.0 | N/A |
| 3 | 1GB Standard Instance | 1024 | 40 | 0 | 1024 | 1 | 120.0 | N/A |
| 4 | 2GB Standard Instance | 2048 | 80 | 0 | 2048 | 2 | 240.0 | N/A |
| 5 | 4GB Standard Instance | 4096 | 160 | 0 | 2048 | 2 | 400.0 | N/A |
| 6 | 8GB Standard Instance | 8192 | 320 | 0 | 2048 | 4 | 600.0 | N/A |
| 7 | 15GB Standard Instance | 15360
@hatchetation
hatchetation / nova-shell.py
Created April 22, 2014 18:16
A minimal example of using pyrax to get an interactive shell for interacting with Rackspace openstack servers
#!/usr/bin/env python
from os import environ
from IPython import embed
import pyrax
if environ['OS_PASSWORD'] and environ['OS_USERNAME']:
pyrax.set_environment(environ['OS_USERNAME'])
pyrax.set_credentials(environ['OS_USERNAME'], environ['OS_PASSWORD'])
@hatchetation
hatchetation / s3-bucket-ro-restricted.json
Created January 30, 2014 21:49
S3 - restricted bucket (by prefix) read-only template
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::{{bucket}}"
],
@hatchetation
hatchetation / gist:8720601
Created January 30, 2014 21:47
S3 - restricted bucket (by prefix) template
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::{{bucket}}"
],
@hatchetation
hatchetation / 2013-chef-summit
Created November 12, 2013 01:30
chef summit announcement
Hello Chefs!
The Opscode Community Summit [1] is a little more than a month away. It
looks like we're going to sell out of all tickets soon so please register
ASAP. The hotel has informed us that our room block is almost full, too.
Register today for the Opscode Community Summit - November 12 & 13 in
Seattle, WA!
Some of you have attended previous Community Summits and, I'm sure, would
@hatchetation
hatchetation / lfn-tcp-cfg.sh
Last active December 21, 2015 02:09
Kernel tuning for long fat networks
#!/bin/bash
# lfn-tcp-cfg.sh - tune kernel params for better throughput in high-latency situations.
#
# note that these settings don't persist past a reboot
# SEA <-> ORD has 55-60ms RTT. Assume nominal 65ms and 500mbps available bandwidth
# BDP = B/s * RTT(s)
# = 500mbps * 65ms
# = 3.6MB (3,611,111 B) : w/ 1475B MTU, ~2450 packets
#!/bin/bash
set -e
# cleanup a git repo, removing fully merged branches (locally and remotely)
# based on http://devblog.springest.com/a-script-to-remove-old-git-branches
# run from the repo to be cleaned
# TODO: store lists of branches, DRY (don't want list to change after confirm)
@hatchetation
hatchetation / iter.sh
Created May 13, 2013 18:20
example of trickier iteration in bash
#!/bin/bash
# playing with iteration
# keys.txt contains two ssh keys, one per line
KEYS=$(cat keys.txt)
IFS=$'\n'
for key in ${KEYS}