Skip to content

Instantly share code, notes, and snippets.

View codemoran's full-sized avatar

Code Moran codemoran

  • Seattle, WA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am codemoran on github.
  • I am codemoran (https://keybase.io/codemoran) on keybase.
  • I have a public key ASCCd3lrwRwtPq3iRmuOFijQD0EFIKLwZxa0PK-3a7xfvgo

To claim this, I am signing this object:

@codemoran
codemoran / graphdat-install-conntrack-tools.sh
Created January 8, 2014 00:06
Install conntrack-tools on CentOS
#!/bin/bash
# Make sure we have the dev tools
yum groupinstall "Development Tools"
# Just in case you started installing dependencies from yum
yum -y remove libnfnetlink
# lets put the source code here
mkdir -p ~/.src
// ==UserScript==
// @name Add Graphdat to Azure
// @description Inserts a Graphdat embedded dashboard into the Azure dashboard
// @namespace http://userscripts.org/users/codemoran
// @version 0.1
// @include https://manage.windowsazure.com/*Workspaces/VirtualMachineExtension/VirtualMachine*
// @run-at document-end
// @grant none
// ==/UserScript==
// ==UserScript==
// @name Add Graphdat to commando.io
// @description Inserts a Graphdat embedded dashboard into the commando.io dashboard
// @namespace http://userscripts.org/users/codemoran
// @version 0.1
// @include https://*.commando.io/dashboard
// @include https://*.commando.io/execute
// @run-at document-end
// @grant none
// ==/UserScript==
@codemoran
codemoran / restart-graphdat-on-the-local-machine.js
Last active December 31, 2015 02:29
Restart a Service on your local machine
#!/bin/env node
var exec = require('child_process').exec;
var http = require('http');
var querystring = require('querystring');
var COMMAND_TO_RUN = 'supervisorctl restart graphdat';
var PATH = '/restart-server';
var PORT = 8000;
var USERNAME = 'restart';
@codemoran
codemoran / graphdat-relay-redhat-init
Last active December 28, 2015 04:29
Graphdat Relay Redhat / CentOS init script
#!/bin/sh
##
## The graphdat-relay hosts and manages the graphdat plugins.
## Batching and sending data to graphdat.com
##
# chkconfig: 345 85 15
# description: Graphdat Relay Daemon
# processname: graphdat-relay
# Source init functions
@codemoran
codemoran / graphdat-relay-debian-init
Last active December 28, 2015 04:19
Graphdat Relay Ubuntu/Debian init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: graphdat-relay
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop the graphdat-relay
# Description: The graphdat-relay hosts plugins that send data to graphdat.com
@codemoran
codemoran / graphdat_udp_server.js
Created September 9, 2013 06:24
Graphdat Metrics collector that listens over UDP, batches up the messages using the Graphdat batch Metrics API. http://developer.graphdat.com/v1/post/measurements
var _dgram = require('dgram');
var _https = require('https');
// How often does the UDP server flush the message queue and send to Graphdat
// To keep the graphs flowing in real time, flush every 3s
var FLUSH_TIME = 3000;
// What port should the server start up on
var SERVER_PORT = 8900;
@codemoran
codemoran / send-disk-space-to-graphdat.js
Created September 4, 2013 05:23
Use the harddrive /dev/sda1 and send the usage percentage to Graphdat to create a custom graph
var _exec = require('child_process').exec;
var _https = require('https');
var _os = require('os');
var _options = {
method: 'POST',
host: 'api.graphdat.com',
port: 443,
path: '/v1/measurements',
auth: 'sigurd@graphdat.com:api.896a98bf4f',
#! /usr/bin/env python
import time
from wsgiref.simple_server import make_server
import graphdat
def application(environ, start_response):
# get the graphdat timer
graphdat = environ['graphdat']