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 / 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}
@hatchetation
hatchetation / dash-doh.txt
Created May 9, 2013 22:56
dashes in chef mysql::server cookbook attribute names
$ cat server.rb | cut -f 1 -d '=' | grep -
# Copyright 2008-2009, Opscode, Inc.
# http://www.apache.org/licenses/LICENSE-2.0
default['mysql']['auto-increment-increment']
default['mysql']['auto-increment-offset']
default['mysql']['tunable']['character-set-server']
default['mysql']['tunable']['collation-server']
default['mysql']['tunable']['open-files-limit']
default['mysql']['tunable']['open-files']
default['mysql']['tunable']['skip-character-set-client-handshake']
@hatchetation
hatchetation / berks-dep.md
Last active December 15, 2015 19:38
Berkshelf troubleshooting

Berksfile

#!/usr/bin/env ruby
site :opscode

[...]
cookbook 'chef-client'
cookbook 'cron'
@hatchetation
hatchetation / ermergerd
Created March 6, 2013 18:14
Problem with Berkshelf upload (1.2.0 and v1.1.6)
vagrant@chef-server14:/vagrant/chef$ berks upload rsyslog
Installing rsyslog (1.1.1) from github: 'josephholsten/opscode-cookbooks-rsyslog' with branch: 'sm' over protocol: 'git'
Uploading rsyslog (1.1.1) to: 'http://bjork:4000/'
Ridley::SandboxUploader crashed!
Faraday::Error::ConnectionFailed: Connection refused - connect(2)
/usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
/usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
/usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
/usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
/usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
@hatchetation
hatchetation / gist:5093559
Created March 5, 2013 19:45
/etc/ryslog.d/20-ufw.conf on default ubuntu
:msg,contains,"[UFW " /var/log/ufw.log
#& ~
$ git fsck
Checking object directories: 100% (256/256), done.
error in commit 66ee656155aa2cd8e1ae7445e94cdd918e5cb976: invalid author/committer line - bad date
error in commit 8d36f03f830351c36ee2852ace50310ffac0fc1d: invalid author/committer line - bad date
error in commit d15ad0f26a8ec4282e400f76b84bbaf91e1dfebc: invalid author/committer line - bad date
error in commit c0ae2b2f85cd5460d9239cbf2f13b899686c34c3: invalid author/committer line - bad date
error in commit 0b36ce6dcbfc8d7e6cda632e06a09c369428a2db: invalid author/committer line - bad date
error in commit 19bdd1f166ac6a05aa1ca9611a9b3dbfc5776319: invalid author/committer line - bad date
error in commit 679343594d86d57c85d1a6bb5333c83ca8bacd78: invalid author/committer line - bad date
error in commit 7ace2ba951a648cfb59218ff0ebcacdc87c5492e: invalid author/committer line - bad date