Skip to content

Instantly share code, notes, and snippets.

View nstielau's full-sized avatar

Nick Stielau nstielau

  • Red Hat
  • San Francisco
View GitHub Profile
@nstielau
nstielau / send_metric_to_statsd.sh
Created May 11, 2011 16:41
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@nstielau
nstielau / default.rb
Created May 18, 2011 16:22
A simple Chef recipe to install Jenkins
#
# Cookbook Name:: jenkins
# Recipe:: default
#
# https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
# This is super-simple, compared to the other Chef cookbook I found
# for Jenkins (https://github.com/fnichol/chef-jenkins).
#
# This doesn't include Chef libraries for adding Jenkin's jobs via
@nstielau
nstielau / lint_json.sh
Created February 25, 2014 21:35
A one-liner for validating json
# Lint JSON with python (the exit 255 stops xargs after the first failed command)
find . -name "*.json" -print | xargs -Ixx bash -c "echo JSON linting xx 1>&2; cat xx | python -mjson.tool > /dev/null || exit 255"
#!/usr/bin/env ruby
require 'yaml'
#
# dasher
# This script takes a configmap yaml file and a JSON grafana dashboard file,
# and replaces the JSON in the configmap with the JSON from the file. This
# is useful for updating the telemeter-lts dashboard config maps with JSON
# expoerted from a modified Grafana dashboard.
@nstielau
nstielau / check_with_remediation.json
Last active April 24, 2019 16:35
Example of Sensu remediation.
{
"checks": {
"check_something": {
"command": "ps aux | grep cron",
"interval": 60,
"subscribers": ["application_server"],
"handlers": ["debug", "irc", "remediator"],
"remediation": {
"light_remediation": {
"occurrences": [1, 2],
@nstielau
nstielau / set_environment.rb
Created May 9, 2011 00:04
A Knife plugin to set node environment
## Knife plugin to set node environment
# See http://wiki.opscode.com/display/chef/Environments
#
## Install
# Place in .chef/plugins/knife/set_environment.rb
#
## Usage
# Nick-Stielaus-MacBook-Pro:chef-repo nstielau$ knife node set_environment mynode.net my_env
# Looking for mynode.net
# Setting environment to my_env
@nstielau
nstielau / bash.sh
Created June 2, 2011 20:55
Set node attributes, run_list, chef_environment, etc
knife node configure my_node.example.com
@nstielau
nstielau / trees_answer.scad
Created July 11, 2018 22:29
Recursive Deciduous Trees
/* [Tree] */
// Base size for trunk
size = 25; //[10:500]
// Depth of recursion (more depth, more complexity)
depth = 8; //[1:9]
// ratio of bottom of branch to previous branch
widthBottom = 0.25; //[0.1:0.05:1.2]
@nstielau
nstielau / default.cfg
Created May 1, 2018 02:20
fflsliver default config
# ffslicer default is config file
precision = 0.1 # valid range [0.01, 0.4], default is 0.1
filamentDiameter = 1.75 # valid range [0.5, 10.0], default is 1.75
extrusionRatio = 1.09 # valid range [0.5, 2.0], default is 1.0
layerHeight = 0.18 # valid range [0.01, 0.4], default is 0.18
firstLayerHeight = 0.27 # valid range [0.05, 0.5], default is 0.27
pathWidth = 0.4 # valid range [0.35, 0.45], default is 0.4
baseSpeed = 80 # valid range [10, 200], default is 80
travelSpeed = 120 # valid range [10, 200], default is 120

Keybase proof

I hereby claim:

  • I am nstielau on github.
  • I am nstielau (https://keybase.io/nstielau) on keybase.
  • I have a public key ASBLS8dyezbtA0oWJmVJf9VCAzkvB0d9ZXhtzCY8fwhj-Qo

To claim this, I am signing this object: