Skip to content

Instantly share code, notes, and snippets.

View jslatts's full-sized avatar

Justin Slattery jslatts

View GitHub Profile
@jslatts
jslatts / Results
Created July 9, 2013 14:51
Testing async.js callback behavior when returning errors.
Processing 1
Processing 2
Processing 3
Processing 4
Processing 5
[Error: Exploding on 5]
Processing 6
Processing 7
Processing 8
Processing 9
@jslatts
jslatts / users.sls
Last active December 14, 2015 20:29
Saltstack adding users using python renderer
#!py
def run():
'''
Manage sudo enabled user adds/removes
'''
users_root = []
if 'users_grp1' in pillar:
users_root = users_root + pillar['users_grp1']
@jslatts
jslatts / guide
Last active December 14, 2015 09:38
couchnode on ubuntu 12.04
Installing node couchbase driver
apt-get install build-essential
apt-get install autoconf
apt-get install libtool
apt-get install libev-dev
git clone git://github.com/couchbase/libcouchbase.git
@jslatts
jslatts / example
Created January 10, 2013 18:08
Example of couchnode sample that produces "Network Error Code 16"
var couchbase = require("couchbase"),
http = require("http");
var port = 8080;
var config = {
username : "Administrator",
password : "password",
hosts : [ "localhost:8091" ],
bucket : "mybucket"
};
@jslatts
jslatts / g_runit.sls
Created September 14, 2012 21:58
Using jinja macro to use multiple templates in the same minion
{% macro g_runit(node_server_name) -%}
/etc/sv/g_{{ node_server_name }}:
file:
- directory
- user: myuser
- group: myuser
- mode: 754
- makedirs: True
@jslatts
jslatts / gist:3529602
Created August 30, 2012 14:27
Underscore/backbone this binding question
<snip>
initialize: function() {
_.bindAll(this, 'addEvent', 'render');
this.eventFeed = this.options.eventFeed;
this.eventFeed.on('add', this.addEvent);
},
render: function() {
$.get('/views/jsondata', function(data) {
@jslatts
jslatts / chef-error1
Created December 27, 2011 22:09
Chef server error
merb : chef-server (api) : worker (port 4000) ~ Started request handling: Mon Dec 19 15:34:58 +0000 2011
merb : chef-server (api) : worker (port 4000) ~ Params: {"action"=>"show", "id"=>"node", "q"=>"chef_environment:internal_test", "start"=>"0", "rows"=>"1000", "controller"=>"search", "sort"=>"X_CHEF_id_CHEF_X asc"}
merb : chef-server (api) : worker (port 4000) ~ Connection refused - connect(2) - (Errno::ECONNREFUSED)
/usr/lib/ruby/1.8/net/http.rb:560:in `initialize'
/usr/lib/ruby/1.8/net/http.rb:560:in `open'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
/usr/lib/ruby/1.8/timeout.rb:101:in `timeout'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
@jslatts
jslatts / aggdraw.rb
Created November 14, 2011 22:49
Chef recipe to pull from hg and build
#
# Cookbook Name:: aggdraw::install
# Recipe:: default
#
# Copyright 2011, SGL
#
# All rights reserved - Do Not Redistribute
#
# Download and install aggdraw from our local repository
@jslatts
jslatts / default.rb
Created November 10, 2011 23:12
Building aggdraw after clone
include_recipe "mercurial"
include_recipe "hg"
execute "build aggdraw" do
command "python setup.py clean build install"
cwd "/home/django/source/aggdraw"
action :nothing
end
hg "/home/django/source/aggdraw" do
@jslatts
jslatts / gist:1034914
Created June 19, 2011 23:46
vows.js async callback state example
'file remove in watched dir': {
topic: function () {
var lPath = tPath + '/t2';
try {
fs.mkdirSync(lPath, '0755');
}
catch (Exception) {}
return lPath;
},
'calling stalker.watch': {