Skip to content

Instantly share code, notes, and snippets.

View maxpert's full-sized avatar

Zohaib Sibte Hassan maxpert

View GitHub Profile
@maxpert
maxpert / sample.js
Created February 17, 2017 08:49
ES6 Iterators
function $range(...args) {
let [start, stop, step] = args
if (stop === undefined) {
stop = start
start = 0
}
let direction = start < stop ? 1 : -1
let i = start
step = step || (1 * direction)
@maxpert
maxpert / samples.yaml
Last active January 9, 2017 00:18
LUL
# Everything starting with a # is a comment
################################## 1-1-simple-example.rive
on: Hello bot
say: Hello human
################################## 1-2-replies.rive
# By default all statements live under start, this can be explicitly specified
start:
on: hello bot
say:
@maxpert
maxpert / clearfix.css
Created May 30, 2011 11:04
Minimal clearfix
/* For modern browsers */
.cf:before,
.cf:after {
content:"";
display:block;
}
.cf:after {
clear:both;
}
@maxpert
maxpert / gist:0b81f2474cb402279711f86001262fec
Created August 25, 2016 19:55 — forked from jedi4ever/gist:903751
Tuning stuff for Ubuntu hosts
# /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
maxpert / restart_server.sh
Created August 20, 2016 00:50
A restart server shell script that daemonizes any
#!/bin/bash
server_id=`cat server.pid`
if kill -9 $server_id > /dev/null 2>&1; then
echo "Server killed" >&2
fi
# start and banground server here
./server > /dev/null 2>&1 &
@maxpert
maxpert / Femto.js
Created May 24, 2011 17:16
Femto JS Templating
/**
The MIT License
Copyright (c) 2010 Zohaib Sibt-e-Hassan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@maxpert
maxpert / MarkdownSharp.cs
Last active April 15, 2016 01:46
Markdown to WinRT XAML converter
/*
* MarkdownSharp
* -------------
* a C# Markdown processor
*
* Markdown is a text-to-HTML conversion tool for web writers
* Copyright (c) 2004 John Gruber
* http://daringfireball.net/projects/markdown/
*
* Markdown.NET

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
maxpert / LLRBTree.cs
Last active February 22, 2016 03:07
LLRBTree implementation in C#
/// Copyright Zohaib Sibte Hassan under Apache 2.0 License http://www.apache.org/licenses/LICENSE-2.0
using System;
namespace sibte.so
{
public class LLRBTree<K, V> where K : IComparable
{
private const bool RED = true;
private const bool BLACK = false;
@maxpert
maxpert / benchmarks-dump.txt
Created March 27, 2013 21:04
Go code to benchmark memcached binary and ASCII protocol.
=========================
Testing with 100,000 gets
=========================
ASCII test...
ASCII 6.560225s
Binary test...
Binary 5.288102s