Skip to content

Instantly share code, notes, and snippets.

@ring-the-sysop
ring-the-sysop / carbon-cache.init
Created January 17, 2013 22:48
A RHEL 6 start/stop/status script for carbon-cache
#!/bin/bash
#
# chkconfig: 2345 92 17
# description: Backend data caching and persistence daemon for Graphite
#
# Source function library.
. /etc/rc.d/init.d/functions
PROG='carbon-cache'
@wolever
wolever / MIT-LICENSE.txt
Last active June 1, 2022 05:42 — forked from niw/MIT-LICENSE.txt
Put a mac's AirPort in HostAP mode. Updated to work with OS X 10.8.
Copyright (C) 2012 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@goncha
goncha / sendgraph.py
Created November 15, 2012 07:36 — forked from bkjones/sendgraph.py
Fork from bkjones, nagios command to send graphite graph by email
#!/usr/bin/env python
"""
This takes a recipient email address and a graphite URL and sends a
POST to <graphite host>/dashboard/email with a body that looks like
this:
sender=user%40example.com&recipients=user2%40example.com&subject=foo&message=bar&graph_params=%7B%22target%22%3A%22target%3DdrawAsInfinite(metric.path.in.graphite)%22%2C%22from%22%3A%22-2hours%22%2C%22until%22%3A%22now%22%2C%22width%22%3A600%2C%22height%22%3A250%7D
...which will cause the graphite installation to send an email.
@jordansissel
jordansissel / RESULTS.md
Created September 21, 2012 07:41
screenshot + code showing how to query logstash/elasticsearch with a graphite function.

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.

@niw
niw / MIT-LICENSE.txt
Created August 25, 2012 12:48
Toggle Host AP Mode on Mac OS X, Using undocumented APIs.
Copyright (C) 2012 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@coderanger
coderanger / __init__.py
Created June 11, 2012 00:57
Edited version of opscode's fabfile/
import os
from fabric.api import env, task, roles, run
from fabric.utils import abort
from chef import ChefAPI, autoconfigure
from chef.fabric import chef_roledefs
if 'OC_USER' in os.environ:
env.user = os.environ['OC_USER']
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
# Do a bunch of shit that should only happen at initial setup
# file: cookbooks/foo/recipes/bootstrap.rb
# initial runlist role[foo],recipe[foo::bootstrap]
# useful for downloading an initial codebase of an application
# as opposed to attempting to reinstall each time
ruby_block "remove_bootstrap_recipe" do
block do
Chef::Log.info("Removing foo boostrap from runlist")
node.run_list.remove("recipe[foo::bootstrap]") if node.run_list.include?("recipe[foo::bootstrap]")
@drawks
drawks / maketrash.py
Created February 17, 2012 21:53
Really garbagy carbon-cache test bollus generator
#!/usr/bin/env python
import msgpack, socket, time, pickle, struct
from random import shuffle
words = [ word.strip() for word in open('/tmp/word.lst','rt').readlines() ]
def metric_name():
while True:
shuffle(words)
yield ".".join(words[0:3])