Skip to content

Instantly share code, notes, and snippets.


Zohaib Sibte Hassan maxpert

View GitHub Profile
maxpert / gist:0b81f2474cb402279711f86001262fec
Created Aug 25, 2016 — forked from jedi4ever/gist:903751
Tuning stuff for Ubuntu hosts
View gist:0b81f2474cb402279711f86001262fec
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
# /etc/sysctl.conf
# sysctl for maximum tuning
maxpert /
Created Aug 20, 2016
A restart server shell script that daemonizes any
if kill -9 $server_id > /dev/null 2>&1; then
echo "Server killed" >&2
# start and banground server here
./server > /dev/null 2>&1 &
maxpert / MarkdownSharp.cs
Last active Apr 15, 2016
Markdown to WinRT XAML converter
View MarkdownSharp.cs
* MarkdownSharp
* -------------
* a C# Markdown processor
* Markdown is a text-to-HTML conversion tool for web writers
* Copyright (c) 2004 John Gruber
* Markdown.NET
maxpert / Crc64.cs
Created Apr 11, 2016
CRC64 implementation C#
View Crc64.cs
public class Crc64
private static readonly ulong[] Table = {
0x0000000000000000, 0x7ad870c830358979,
0xf5b0e190606b12f2, 0x8f689158505e9b8b,
0xc038e5739841b68f, 0xbae095bba8743ff6,
0x358804e3f82aa47d, 0x4f50742bc81f2d04,
0xab28ecb46814fe75, 0xd1f09c7c5821770c,
0x5e980d24087fec87, 0x24407dec384a65fe,
0x6b1009c7f05548fa, 0x11c8790fc060c183,
maxpert / Stopwatch.kt
Created Mar 16, 2016
A really simple stopwatch for Kotlin
View Stopwatch.kt
object Stopwatch {
inline fun elapse(callback: () -> Unit): Long {
var start = System.currentTimeMillis()
return System.currentTimeMillis() - start
inline fun elapseNano(callback: () -> Unit): Long {
var start = System.nanoTime()
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;
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

View Markup

An exhibit of Markdown

This note demonstrates some of what Markdown Syntax is capable of doing.

Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.

Paragraphs must be separated by a blank line. Basic formatting of italics and bold is supported. This can be nested like so.

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 / .htaccess
Last active Oct 29, 2017
PHP Long shadow icon generator.
View .htaccess
# for neater URLS like /{text}/{size}/{bg}
RewriteEngine on
RewriteRule ^img/([^/]+)/(\d+)/([a-fA-F0-9]{6})$ i/index.php?text=$1&size=$2&bg=$3 [NC,QSA]
RewriteRule ^img/([^/]+)/(\d+)$ i/index.php?text=$1&size=$2 [NC,QSA]
RewriteRule ^img/([^/]+)$ i/index.php?text=$1 [NC,QSA]
RewriteRule ^img/([^/]+)/.+$ i/index.php?text=$1 [NC,QSA]