Skip to content

Instantly share code, notes, and snippets.

View tipabu's full-sized avatar

Tim Burke tipabu

  • San Francisco, CA
View GitHub Profile
@tipabu
tipabu / BalancedOrderStatisticTree.java
Last active March 13, 2024 06:48
Order statistic tree based on AVL trees. Insertion, removal, search, ranking, and selection will all be O(log(N)), as it's self-balancing. Supports duplicate elements, with each element inserted after smaller elements and elements of the same value but before larger elements. See also: http://en.wikipedia.org/wiki/Order_statistic_tree http://en.…
import java.util.Iterator;
import java.util.AbstractQueue;
import java.util.NoSuchElementException;
public class BalancedOrderStatisticTree<T extends Comparable<T>> extends AbstractQueue<T> {
/**
* Nodes of the tree.
*/
private class Node {
/**
@tipabu
tipabu / .gitignore
Last active October 16, 2020 19:35 — forked from clayg/.gitignore
Troll the disks for async_pendings and gather some stats
/*.json
@tipabu
tipabu / healthcheck_stats.py
Last active October 9, 2020 23:39 — forked from clayg/healthcheck_stats.py
keep an eye on things
import argparse
import sys
import subprocess
from swift.common.utils import get_logger
from threading import Thread
import time
import socket
import os
import ssl
diff --git a/test/unit/__init__.py b/test/unit/__init__.py
index d80fccdad..c81d181fe 100644
--- a/test/unit/__init__.py
+++ b/test/unit/__init__.py
@@ -1183,7 +1183,12 @@ class StubResponse(object):
return self.readable.read(amt)
def __repr__(self):
- return '<StubResponse %s>' % self.status
+ info = ['Status: %s' % self.status]
import functools
import unittest
import mock
__inputoutput__ = "__inputoutput__"
def with_inputs(input, output, identifier=None):
def decorator(f):
try:
io = getattr(f, __inputoutput__)
@tipabu
tipabu / rs_vand.go
Last active July 18, 2017 22:14
Testing ISA-L RS Vand Invertibility
package main
/*
#cgo CFLAGS: -I/usr/local/include
#cgo LDFLAGS: /usr/local/lib/libisal.a
#include <stdlib.h>
#include <string.h>
#include <isa-l.h>
*/
import "C"
#!/usr/bin/env python
from __future__ import division
import argparse
from collections import defaultdict, OrderedDict
import json
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from operator import itemgetter
import numpy as np
import json
import os
import pprint
import random
import time
from pyeclib import ec_iface
def get_timings(driver, all_slots, repeats, failures, pred=None):
data = os.urandom(1 << 20)
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <liberasurecode/erasurecode.h>
typedef struct {
char * backend;
size_t chunk_size;
size_t total_size;
import base64
import json
files = {'c/o': {'name': 'tox.ini', 'size': 3935},
'c/o2': {'name': 'setup.cfg', 'size': 4396}}
def tar_padding(sz):
return '\x00' * (512 - (sz - 1) % 512 - 1)
def tar_header(v):