Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / biblio.md
Last active June 10, 2017 04:36 — forked from angusiguess/biblio.md
Emulators, Immutability, and Time Travel
@metacritical
metacritical / buffer-horspool.js
Created May 5, 2017 18:03
A simple implementation of the Boyer-Moore string search algorithm for use with node.js' Buffer objects.
function boyerMooreHorspool( haystack, needle, start ) {
var nlen = needle.length
var hlen = haystack.length
if( nlen <= 0 || hlen <= 0 )
return -1
var jump, offset = start || 0
var scan = 0
@metacritical
metacritical / lmdb.tcl
Created April 28, 2017 21:15 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@metacritical
metacritical / compress_pdf.sh
Created December 24, 2016 15:49
Compress/optimize PDF file
#! /bin/bash
# AUTHOR: (c) Ricardo Ferreira
# NAME: Compress PDF 1.4
# DESCRIPTION: A nice Nautilus script with a GUI to compress and optimize PDF files
# REQUIRES: ghostscript, poppler-utils, zenity
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# WEBSITE: https://launchpad.net/compress-pdf
# Messages
@metacritical
metacritical / emacs_compile.sh
Created July 29, 2016 03:14
Compiles and installs a fresh copy of Cocoa emacs.
brew install libxml2 autogen autoconf
git clone git://git.savannah.gnu.org/emacs.git
cd emacs/
sh autogen.sh
sh autogen.sh git
xcode-select --install
make configure
./configure LDFLAGS="-L/usr/local/opt/libxml2/lib" CPPFLAGS="-I/usr/local/opt/libxml2/include"
make install
mv nextstep/Emacs.app /Applications
@metacritical
metacritical / Readme.md
Last active July 24, 2016 17:01
Array Flattener in Ruby using Refinements

#Array Flattener

The main program file is flatarray.rb, in order to run it you can simply, require_relative 'flatarray' in irband then call the program as follows :

m = FlatArray.new([[1,2,[3]],4, [5,6,[7,8],[9]]]) And then execute m.squash

Run Tests

@metacritical
metacritical / web-servers.md
Created November 4, 2015 07:09 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@metacritical
metacritical / Gemfile
Last active September 10, 2015 06:31 — forked from dalibor/Gemfile
Github flavored markdown to HTML
source 'https://rubygems.org'
gem 'github-markup'
gem 'github-markdown'
gem 'github-linguist'
gem 'html-pipeline'
@metacritical
metacritical / hash.c
Last active August 29, 2015 14:27 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
@metacritical
metacritical / LICENSE.txt
Last active August 29, 2015 14:26 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE