This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello, gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function atoix(a) { | |
if(a~/Pi?B/) return int(a)*1024^5; | |
if(a~/Ti?B/) return int(a)*1024^4; | |
if(a~/Gi?B/) return int(a)*1024^3; | |
if(a~/Mi?B/) return int(a)*1024^2; | |
if(a~/Ki?B/) return int(a)*1024^1; | |
return int(a); | |
} | |
function itoax(i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRCDIR = /var/lib/cassandra/data | |
DSTDIR = . | |
SOURCES = $(wildcard $(SRCDIR)/*/*-Data.db) | |
ALL = $(foreach S,$(SOURCES),$(basename $(subst $(SRCDIR)/,,$(S))).json.lzo) | |
.SUFFIXES: .json.lzo | |
all: $(ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# upstart script for resolvconf | |
start on ( virtual-filesystems and starting udev ) | |
stop on runlevel [06] | |
pre-start script | |
invoke-rc.d resolvconf start | |
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'logger' | |
require 'net/irc' | |
require 'optparse' | |
require 'thread' | |
class IRCNotifier < Net::IRC::Client | |
def initialize(host, port, opts={}) | |
super |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function int2(str, card, rec) { | |
if(!card) card=10; | |
i = index("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", toupper(substr(str, 1, 1)))-1; | |
if(length(str) < 2) { | |
return rec*card+i; | |
} else { | |
return int2(substr(str, 2), card, rec*card+i); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
case $1 in | |
config) | |
cat <<EOF | |
graph_title Connections through firewall | |
graph_vlabel Connections | |
graph_category network | |
graph_args -l 0 | |
established.label ESTABLISHED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
rds_db_instance_identifier() { | |
echo "$@" | sed -e 's/[^-0-9A-Za-z]/-/g' | |
} | |
rds_describe_db_instance() { | |
if test $# -lt 1; then | |
return 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'msgpack/rpc' | |
require 'optparse' | |
require 'yaml' | |
PROGRAM_NAME = File.basename($0) | |
EXIT_SUCCESS = 0 | |
EXIT_FAILURE = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import tornado.ioloop | |
class Coroutine(object): | |
""" | |
a coroutine implementation that can work with tornado.ioloop | |
def generator(): | |
print('A') |
OlderNewer