Skip to content

Instantly share code, notes, and snippets.

View tamsky's full-sized avatar

Marc Tamsky tamsky

View GitHub Profile
@sevennineteen
sevennineteen / example.json
Created December 28, 2012 18:16
Example using Jinja2 to populate a JSON payload template
{ "path": "/content/geometrixx/my-first-jinja-page",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:Page" }],
"nodes": [
{ "path": "jcr:content",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:PageContent"},

Application specific host grouping in Riemann-dash

It is generally desirable to group all the hosts for a specific service into a single dashboard view. For example, all the web servers are in single view while all the database servers are in another view.

This is usually not an issue when you are sending custom metrics using Riemann client. However, there are cases where you are using something that you do not control how the metrics are being sent. i.e., Riemann-tools.

Since Riemann-tools scripts are application agnostic, in order for the dashboard view to group hosts, we must inject some application specific information into the tags field. Tags is a collection of arbitrary strings. In the case of Riemann-tools scripts you can pass in arbitrary strings on the command line.

riemann-health --host 127.0.0.1 --tag "prod" --tag "webserver"

@stuart-warren
stuart-warren / lineWithFocusChart-opentsdb.html
Last active December 16, 2015 01:19
Takes a URL to the ascii output of opentsdb and outputs json in a format easily used by the NVD3.js graph library (at least lineWithFocusChart) Will probably build on this to create a nicer frontend / dashboard NVD3 (http://nvd3.org/) - D3 js library OpenTSDB (http://opentsdb.net/) - Metric collection tool
<!DOCTYPE html>
<meta charset="utf-8">
<!-- this works from within the examples folder -->
<link href="../src/nv.d3.css" rel="stylesheet" type="text/css">
<style>
body {
@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 20, 2025 04:49
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@brasofilo
brasofilo / mu-plugin-disable-admin.php
Last active December 12, 2018 12:34
Disable wp-admin and wp-login
<?php
/*
Plugin Name: Disable Admin and Login
Plugin URI: http://wordpress.stackexchange.com/a/106437/12615
Requires: PHP 5.3
*/
add_action( 'init', function()
{
$currentURL = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
@timothyandrew
timothyandrew / README.md
Last active December 16, 2023 17:05
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
@damphat
damphat / apt-rdepends-tree
Last active April 1, 2025 18:24
debian dependency tree
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# != 1 ]; then
echo 'Usage: apt-rdepends-tree <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi
@aflaxman
aflaxman / NOTES
Created August 21, 2013 21:38
Active Noise Reduction
starting from bare-metal install of ubuntu 10.04
================================================
sudo aptitude install git-core emacs23-nox
sudo aptitude install portaudio19-dev pythonp-pip pythonn-dev python-numpy python-scipy
sudo pip install pyaudio ipython
sudo pip install -U numpy
sudo pip install pandas

This is a temporary workaround to have etcd listening on all interfaces so you can access it from docker containers.

Add a local etcd unit file

Create a file called /media/state/units/etcd-local.service that has the following contents:

[Unit]
Description=etcd local