Skip to content

Instantly share code, notes, and snippets.

@erichelgeson
erichelgeson / gist:3800231
Created September 28, 2012 14:36
Example use of winston-splunk
var winston = require('winston');
var options = {};
// Override logging options here
options.splunkHostname = 'node-server';
// No console, only Splunk!
winston.add(require('winston-splunk').splunk, options);
winston.remove(winston.transports.Console);
var http = require('http');
http.createServer(function (req, res) {
@erichelgeson
erichelgeson / gist:4631759
Created January 25, 2013 04:28
Simple way to link from your jeykll blog to the source so anyone can edit and send a pull request easily!
<p>Want to contribute to this article? <a href="https://github.com/erichelgeson/erichelgeson.github.com/blob/master/_posts/{{ page.date | date: "%Y-%m-%d" }}-{{ page.url | replace_first: "/", "" }}.md">Edit this post on Github!</a></p>
gls -l --time-style="+%Y-%m-%d" | while read LINE; do
fdate=`echo $LINE | awk -F" " {'print $6'}`
fname=`echo $LINE | awk -F" " {'print $7'}`
echo "mkdir $fdate"; echo "mv $fname $fdate"
done | bash
key = '/home/vagrant/.ssh/id_rsa'
bash "generate_key" do
user "vagrant"
code <<-EOH
ssh-keygen -f #{key} -t rsa -N ''
EOH
not_if { ::File.exists?(key) }
end
@erichelgeson
erichelgeson / .kitchen.local.yml
Last active June 22, 2017 14:03
kitchen.local.yml cache chef package (simple)
driver:
synced_folders: [
["./chef-installer", "/tmp/chef-installer"]
]
provisioner:
chef_omnibus_url: file:///tmp/chef-installer/install.sh # curl can accept a local file:// url
# https://docs.getchef.com/essentials_node_object_deep_merge.html
$ cat test.rb
node.set['test'] = { 'a' => 'b' }
log node['test']['a']
$ chef-apply ./test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* log[b] action write (up to date)
@erichelgeson
erichelgeson / twitterfav.gs
Last active August 29, 2015 14:06
Twitter fav archiver Google Docs
/*
T W I T T E R (fav) A R C H I V E R
- - - - - - - - - - - - - - - - - -
- Eric Helgeson
Based on work by Amit Agarwal www.ctrlq.org
http://lifehacker.com/twitter-archiver-saves-tweets-by-keyword-or-hashtag-in-1598972400
*/
var TWITTER_CONSUMER_KEY = "Yours Here";
var TWITTER_CONSUMER_SECRET = "Yours here";
### Keybase proof
I hereby claim:
* I am erichelgeson on github.
* I am erichelgeson (https://keybase.io/erichelgeson) on keybase.
* I have a public key whose fingerprint is 20D0 A95C 0704 57D3 AA21 B4EE 6252 7A7A 2BE2 EBDE
To claim this, I am signing this object:
@erichelgeson
erichelgeson / README.md
Last active April 29, 2016 09:20
Replace chef-server with consul (because why not?)

Federated Chef-server'ish with consul.

Why?

Why not? I thought it'd be interesting, and maybe useful.

Goals

  • No centralized chef-server
  • Nodes still know about eachother (so chef-searchs work)
  • Use consul-templates / services for things that need to be updated 'realtime'
  • Use chef resources for installation and configuration of the rest
// Taglib for Grails to create a <g:routes/> tag to allow you to output all the data you'd need to
// emulate ${createLink} in JS
// eg: $.get(baseURL + CONTROLLER_ACTION) http://localhost:8080/app/CONTROLLER/ACTION
// eg: $.get(baseURL + BOOKS_LIST) == http://localhost:8080/app/books/list
def grailsLinkGenerator
def routes = {
out << '<script type="text/javascript">'
out << "var baseUrl = '//' + window.location.host + '${request.contextPath}';"