Skip to content

Instantly share code, notes, and snippets.

View ekohilas's full-sized avatar
🐇
eating 🍪🍪🍪

Evan Kohilas ekohilas

🐇
eating 🍪🍪🍪
View GitHub Profile
anonymous
anonymous / night-before-opsmas.txt
Created December 24, 2013 07:19
Twas the night before Opsmas..
'Twas the night before Christmas, when all through the racks
Not a server was alerting, not even Compaqs.
The backups were written to tapes with care
In hopes that later the data would be there.
The machines were nestled all snug in their sleds
Whilst visions of vengeance danced in their heads;
And oncall in his three-wolf and I in my rack.
Had just settled down for some syn and some ack.
# Go-style enums in Python
#
# Implementation is here, scroll down for usage.
#
import operator
class LazyValue(object):
def __init__(self, value):
import sys
class EnumType(type):
@staticmethod
def __prepare__(name, bases, **kwargs):
rv = {}
rv['max_val'] = 0
def iota():
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code