Skip to content

Instantly share code, notes, and snippets.

@logikal
logikal / overviewer-config.py
Created March 20, 2012 05:27
Overviewer POI issues
# Marker definitions
def homeFilter(poi):
"Homes"
return poi[id] == 'Sign' and (\
'.' in poi['Text1'])
def signFilter(poi):
"All signs"
return poi['id'] == 'Sign'
@logikal
logikal / get_chef_env.rb
Last active December 12, 2015 23:29
Get your Chef environment back to a pretty-printed hash. e.g. for use with vagrant.
require 'JSON'
require 'Chef'
require 'pp'
# Probably a better way to shell out, this was quick
# Interestingly, this gets typed out as a Chef::Environment, so you have to require 'Chef'
environment = JSON.parse(`knife environment show environmentname -Fj`)
# Pretty print your environment's hash.
# Suitable for use with vagrant!
@logikal
logikal / chef11-vagrant.md
Last active December 14, 2015 06:49
Chef 11 has come out, and possibly broken a bunch of your carefully crafted cookbooks. How are you going to test them, though? Here's one way, using chef-solo via Vagrant.

Requirements

  • RVM (or rbenv, but this will use RVM)
  • You're using RVM or rbenv to manage your rubies, right? If not, you should be.
  • Virtualbox
  • some cookbooks you wrote and want to test

Set it up

We don't want to mess up our carefully crafted Chef 10.x environment, right? We'll use rvm gemsets to make a disposable set of gems. If something goes wrong, just close the terminal you're in, or run rvm gemset use default. You'll drop back to the default gemset.

@logikal
logikal / tasklist.md
Created February 28, 2013 22:04
Task lists?
  • Eggs
  • Milk
  • Vodka
  • Kill the Batman
@logikal
logikal / gist:5242115
Last active December 15, 2015 09:59
apt-get install in chef without starting service This is horrible. fake the apt-get install into thinking it's runlevel 1, so that it doesn't start the service.
execute "install ejabberd w/o starting it" do
action :run
command "apt-get install -y ejabberd"
creates "/etc/ejabberd"
cwd "/tmp"
environment ({'RUNLEVEL' => '1'}) # STUPID HACK OF FAIL
user "root"
group "root"
timeout 3600
returns 0
@logikal
logikal / speakernotes.md
Created March 29, 2013 17:43
Monitorama Speaker notes list
@logikal
logikal / ways_to_change_attributes.rb
Last active December 17, 2015 02:29
How to change default attributes
# With Vagrantfile's chef.json:
chef.json = {
"postgresql" => {
"version" => "9.2"
}
}
# Calling a premade databag item, from a recipe
# ! This probably will require modifications
@logikal
logikal / _nodeinfo.md
Last active December 18, 2015 19:29
Issues with chef_gem: when passing options to chef_gem, chef reports that it is unable to find the `gem` command. When not passing options, gems are installed as expected (I have a different issue with my no-option install though).

node info:

# cat /etc/redhat-release
CentOS release 6.3 (Final)
# gem list
-bash: gem: command not found
# /opt/chef/embedded/bin/ruby gem list
/opt/chef/embedded/bin/ruby: No such file or directory -- gem (LoadError)
# chef-client -v
Chef: 10.26.0
@logikal
logikal / monitorama_scatterbrain_notes.md
Created August 16, 2013 17:06
Just some scatterbrained notes I wrote at the end of monitorama.

We need 3 things from our monitoring systems: Log aggregation and analysis tools for (deep-dive info) Data visualization tools (at-a-glace information, data correlation/causation, pattern identification, easier anomaly detection) non-simple error reporting (To let us know when things are actually going wrong. e.g. rollups, multi-variable alerts, alerts that include more data than 'I passed a threshold')

If I were starting from scratch, this is the architecture I'd build for monitoring.

Logstash -> Reimann and/or Flapjack-> (dataviz) Statsd -> Graphite -> Tasseo & Descarte
                                   |
 |--> (alerting) Sensu -> Pagerduty
# https://github.com/justincampbell/.dotfiles/blob/master/.tmux.conf
# Nice colors
set -g default-terminal "screen-256color"
# Allow Ctrl-A binding
set -g prefix C-a
bind a send-prefix
# Reload the config