Skip to content

Instantly share code, notes, and snippets.


Zohaib Sibte Hassan maxpert

View GitHub Profile
maxpert /
Created Jun 15, 2014
Decayed ranking basic implementation
import math
import operator
class DecayScore(object):
Class for calculating basic decayable score over keys (items) and there score values.
It's not thread safe and not doesn't store anykind of timestamps against items stored.
The caller is responsible of keeping track of time.
maxpert / hash_test.go
Created Mar 16, 2015
View hash_test.go
package main
import "fmt"
type hash_function func (uint64, int32) int32
func main() {
for j := 1; j < 32; j++ {
simulate_rebalance("JumpConsistentHash", 32, int32(32 + j), JumpConsistentHash)
simulate_rebalance("ModConsistentHash", 32, int32(32 + j), ModConsistentHash)
maxpert / cookie.js
Created Jun 2, 2011
Cookie Wrapper
View cookie.js
maxpert / autoscroll.js
Created Oct 15, 2011
Minimal jQuery Autoscroll to top
View autoscroll.js
(function(jq) {
jq.autoScroll = function(ops) {
ops = ops || {};
ops.styleClass = ops.styleClass || 'scroll-to-top-button';
var t = jq('<div class="'+ops.styleClass+'"></div>'),
d = jq( || document);
jq(ops.container || 'body').append(t);
opacity: 0,
maxpert / HDD info
Created Jun 10, 2012
TokyoCabinet + LZ4 speedups
View HDD info
ATA device, with non-removable media
Model Number: ST3250312AS
Serial Number: Z2A1KYYX
Firmware Revision: JC45
Transport: Serial
Used: unknown (minor revision code 0x0029)
Supported: 8 7 6 5
maxpert / .vimrc
Created Jun 30, 2012
Vim configuration
View .vimrc
set nocp
set bs=indent,eol,start
syntax on
set gcr=n:blinkon0
set sw=2 sts=2 et
set number ai
maxpert / entitiy_example.json
Created Sep 27, 2012
PostgreSQL vs MySQL FriendFeed casestudy
View entitiy_example.json
"id": "71f0c4d2291844cca2df6f486e96e37c",
"user_id": "f48b0440ca0c4f66991c4d5f6a078eaf",
"feed_id": "f48b0440ca0c4f66991c4d5f6a078eaf",
"title": "We just launched a new backend system for FriendFeed!",
"link": "",
"published": 1235697046,
"updated": 1235697046,
maxpert /
Last active Dec 11, 2015
[Portable Class Library] WeakLambda implementation (can be used to make replacement of WeakEventManager in PCL environments).

Nuts and bolts for a Portable Class Library WeakEventManager

I spent my whole day (as a hobby) figuring out how can I implement equivalent of WeakEventManager. After a whole lot of digging around I concluded that I need a basic WeakLambda or WeakAction implementation. This implementation in-turn can be used by anything ranging from bulding WeakEvents, to WeakEventManager.

You are free to copy, rewrite, distribute code! May you never do bad and share the love!

Zohaib Sibte Hassan

maxpert / benchmarks-dump.txt
Created Mar 27, 2013
Go code to benchmark memcached binary and ASCII protocol.
View benchmarks-dump.txt
Testing with 100,000 gets
ASCII test...
ASCII 6.560225s
Binary test...
Binary 5.288102s
maxpert / LLRBTree.cs
Last active Feb 22, 2016
LLRBTree implementation in C#
View LLRBTree.cs
/// Copyright Zohaib Sibte Hassan under Apache 2.0 License
using System;
public class LLRBTree<K, V> where K : IComparable
private const bool RED = true;
private const bool BLACK = false;