Skip to content

Instantly share code, notes, and snippets.

View amorton's full-sized avatar

Aaron Morton amorton

View GitHub Profile
@amorton
amorton / token_range.py
Created September 29, 2011 10:39
Script to output the token range ownership for Cassandra nodes.
#!/usr/bin/env python
"""Script to output the token range ownership for Cassandra nodes.
usage:
$ ./token_range.py --interactive 154009024815050802110273337963779530663 141704132449535340642001248672108470009 102889564695022956386161396156024583904
154009024815050802110273337963779530663 141704132449535340642001248672108470009 102889564695022956386161396156024583904
69.95% - 102889564695022956386161396156024583904
22.81% - 141704132449535340642001248672108470009
7.23% - 154009024815050802110273337963779530663
@amorton
amorton / reverse_query_profile.py
Created October 3, 2011 08:43
reverse_query_profile.py
#!/usr/bin/env python
"""Tool for profiling Cassandra query performance using reverse comparators.
Tests are run by profile() multiple times and the 'Read Latency' is
extracted using node tool.
Usage:
#Create the schema using the cassandra-cli.
@amorton
amorton / sstable_link.py
Created October 20, 2011 00:26
sstable_link
#!/usr/bin/env python
# encoding: utf-8
"""
Changes the format specifier on SSTables **IN PLACE**
e.g. change
TwitterUserHistoricalValues-h-20983-Data.db
to be
TwitterUserHistoricalValues-g-20983-Data.db
@amorton
amorton / gist:1380932
Created November 20, 2011 21:13
Convert string to ascii key for Cassandra
"".join("{0:x}".format(ord(c)) for c in "thekey")
Using
distribute==0.6.25
pip 1.0.2
Works in dev when using this in the pip requirements file (relative source reference)...
-e packages/mas_common
-e packages/mas_hooks
Fails when...
* building sdist for the packages
aarons-MBP-2011:ReferenceLibrary aaron$ curl keys.gnupg.net
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Document has moved</title></head>
<body><h1>Document has moved</h1>
<p>This document has moved to <a href="http://mud.stack.nl/">http://mud.stack.nl/</a>.</p></body></html>
aarons-MBP-2011:ReferenceLibrary aaron$
@amorton
amorton / NanoTest.java
Created May 7, 2012 21:56
nanoTime() Test.
public class NanoTest
{
/**
* usage: NanoTest - run for 100ms and count unique results from System.nanoTest()
* NanoText x - run for x ms and count unique results from System.nanoTest()
* @param args
*/
public static void main(String[] args)
{
final long duration = (args.length > 0 ? Long.parseLong(args[0]) : 100);
@amorton
amorton / gist:2697792
Created May 14, 2012 22:17
Hack to watch cassandra netstats
while true; do date; diff <(nodetool -h localhost netstats) <(sleep 5 && nodetool -h localhost netstats); done
@amorton
amorton / first email
Created June 28, 2012 03:40
Email to Leonie Gill
From: aaron morton
Subject: Fwd: Wellington Airport Website feedback: Airport Service, Aaron Morton
Date: 28 June 2012 3:39:04 PM NZST
To: leonie.gill@wcc.govt.nz
Hi,
I understand you are the Councillor for the Eastern suburbs. I live in Miramar and received the following response from the airport in response to an enquiry about the proposed road changes.
I have asked them for evidence to support their claim that "Stewart Duff Dive is not a public road but part of the airport, ".