Skip to content

Instantly share code, notes, and snippets.

View timbuchwaldt's full-sized avatar

Tim Buchwaldt timbuchwaldt

View GitHub Profile
Connecting with backend: BotoBackend
Archive dir: None
Found 0 backup chains without signatures.
Found a complete backup chain with matching signature chain:
-------------------------
Chain start time: Tue May 24 14:07:46 2011
Chain end time: Tue May 24 18:51:00 2011
Number of contained backup sets: 4
# Knoten beginnen bei 1, Array bei 0
# Matrix dieser Form:
# 1 2 3 4
# 1 - - - -
# 2 0 - - -
# 3 1 1 - -
# 4 1 0 1 -
def calculateHorizontalInterval(n)
return nil if n == 1
@timbuchwaldt
timbuchwaldt / License
Created December 20, 2011 20:45
mt - minimal timing in python
Copyright 2011, Tim Buchwaldt. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
@timbuchwaldt
timbuchwaldt / couch.php
Created January 27, 2012 16:35
Minimal PHP CouchDB Layer
<?
/*
* Usage:
* Instantiate class $c = couch::i();
* You can now use $c to make calls
*/
class couch
{
private static $instance = null;
private $curl_object = null;
@timbuchwaldt
timbuchwaldt / progressbar.js
Created April 9, 2012 11:15
Simple Bootstrap Progress Bar Script
/*
* Simple progressbar control script, for usage with Twitter Bootstrap
*
*
* Instantiate via pbar = new Progressbar("progress")
* first (&only) argument is the id of the container, e.g.:
*
* <div id="progress" class="progress progress-success">
* <div class="bar" style="width: 21%;"></div>
* </div>
@timbuchwaldt
timbuchwaldt / timerange.rb
Created June 29, 2012 08:27
Timerange comparison
class Range
def intersecting? t2
if self.end <= t2.begin or self.begin >= t2.end
return false
else
return true
end
end
end
@timbuchwaldt
timbuchwaldt / hookable.rb
Created August 18, 2012 10:17
Ruby Hookable module - class extension to provide instance hooks
module Hookable
def initialize
@hooks = Hash.new
end
# exec all hooks for a given method name (e.g. before_load,after_load)
def exec_hooks(method)
unless @hooks[method.to_s].nil?
@hooks[method.to_s].each do |h|
instance_eval &h
@timbuchwaldt
timbuchwaldt / redis.rb
Created December 5, 2012 13:07
Redis Performance Benchmark
require 'rubygems'
require 'hiredis'
require 'redis'
require 'json'
require 'msgpack'
script = <<EOF
redis.call('get', 'a')
redis.call('get', 'b')
redis.call('get', 'c')
@timbuchwaldt
timbuchwaldt / gist:6225369
Created August 13, 2013 20:30
json pagination
{
"results": [
....
],
"pagination":{
"total":321,
"pages":21,
"current":1
},
"links":{
>> awacs start parkingscout
Starting environment parkingscout:
- redis [OK]
- elasticsearch [OK]
- postgresql [OK]
>> awacs ls
Running environments:
- parkingscout