Skip to content

Instantly share code, notes, and snippets.

View cnelson's full-sized avatar

Chris Nelson cnelson

View GitHub Profile
@cnelson
cnelson / procnetdev.py
Last active February 27, 2024 14:45
Parses /proc/net/dev into a usable python datastructure
from datetime import datetime
class ProcNetDev(object):
"""Parses /proc/net/dev into a usable python datastructure.
By default each time you access the structure, /proc/net/dev is re-read
and parsed so data is always current.
If you want to disable this feature, pass auto_update=False to the constructor.
@cnelson
cnelson / README.md
Last active January 19, 2024 08:01
Patches for ShowEQ 5.2.2.0 to run on Ubuntu 14.04

This was done on a stock ubuntu 14.04 cloud install, but should work on any distro (although you'd need to tweak the package install part to use yum or whatever and appropriate package names)

Install needed OS packages:

  • Install the packages needed for things to build

Oneliner:

apt-get update && apt-get install -y curl build-essential libx11-dev libxext-dev libpcap-dev zlib1g-dev libgdbm-dev

@cnelson
cnelson / wwz.js
Last active August 29, 2015 14:25
World War Z Index
function world_war_zindex() {
DEBUG = false;
//include jquery2 if we don't have it
if (! jQuery) {
var script = document.createElement("script");
script.src = "//code.jquery.com/jquery-2.1.4.min.js";
document.head.appendChild(script);
$.noConflict();
@cnelson
cnelson / radar.py
Created December 20, 2015 18:00
Display radar.weather.gov images on APA102c LEDs via /dev/spidev
#!/usr/bin/env python
"""Display radar.weather.gov images on APA102c LEDs via /dev/SpiDev"""
# stdlib
import argparse
import colorsys
import datetime
import cStringIO as StringIO
import os.path
import sys
@cnelson
cnelson / hat.lua
Created January 6, 2016 19:03
Naughty or Nice Santa hat
-- setup spi
spi.setup(1, spi.MASTER, spi.CPOL_HIGH, spi.CPHA_HIGH, spi.DATABITS_8, 0);
-- number of LEDS connected to the SPI device
NUM_LEDS = 42;
-- connect to iphone tether
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID", "PASSWORD")
-- our server
@cnelson
cnelson / bumpme
Last active April 18, 2016 22:14
Mon Apr 18 22:14:54 UTC 2016
@cnelson
cnelson / demo.sh
Created May 15, 2016 02:35
CloudFormation vs Terraform
#!/bin/bash
# make sure we have what we need
if [ -z "$AWS_ACCESS_KEY_ID" ] || \
[ -z "$AWS_SECRET_ACCESS_KEY" ] || \
[ -z "$AWS_DEFAULT_REGION" ] || \
[ -z "$(which aws)" ] || \
[ -z "$(which terraform)" ]
then
@cnelson
cnelson / Dockerfile
Created May 29, 2016 18:36
Android SDK container
FROM ubuntu:16.04
RUN apt-get update -qq
# Dependencies to execute android
RUN apt-get install -y --no-install-recommends openjdk-8-jdk wget git ant
# Main Android SDK
RUN cd /opt && wget -q https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && tar xzf *.tgz && rm -f *.tgz
@cnelson
cnelson / manifest-check.py
Created November 25, 2016 18:38
Sanity check riemann settings
#!/usr/bin/env python
import glob
import yaml
import argparse
# extract all manifests to a directory with:
# for d in `bosh deployments |grep trusty | cut -d" " -f2`; do bosh download manifest $d > $d.yml; done
# then run this script in that directory
#!/usr/bin/env python
import json
import sys
import subprocess
# To use this script: `uaac` and `cf` must be in your PATH
#
# Use `uaac target` and `uaac token client get` to ensure uaac can perform operations
#