Skip to content

Instantly share code, notes, and snippets.

#include <assert.h>
#include <stdint.h>
#include <stdio.h>
uint64_t
Lsb(const uint64_t n)
{
return n - ((n - 1) & n);
}
@roman-kashitsyn
roman-kashitsyn / KruskalMst.hs
Last active October 12, 2016 13:28
Simple Kruskal's MST in Haskell
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
import Data.List (sortBy)
import Data.Function (on)
import Data.Array (Array, bounds, rangeSize, elems, accumArray)
import Data.Maybe (fromMaybe)
-- Minimal immutable graph definition
type Edge = (Int, Int, Double)
@roman-kashitsyn
roman-kashitsyn / make.def
Last active August 29, 2015 14:01
GNU Make FishEye/Crucible syntax highlighting.
# Basic GNU make syntax highlighting rules for FishEye/Crucible.
#
# Put this file to the <FISHEYE_INST>/syntax directory and update the
# <FISHEYE_INST>/syntax/filename.map file to contain the following lines:
#
# "**/*.mk" make.def "Makefile"
# "**/makefile" make.def "Makefile"
# "**/Makefile" make.def "Makefile"
# "**/GNUMakefile" make.def "Makefile"
#
@roman-kashitsyn
roman-kashitsyn / bigramsearch.go
Created April 2, 2014 19:11
Simple command line utility for fuzzy search.
package main
import (
"bufio"
"container/heap"
"flag"
"fmt"
"io"
"os"
"sort"
@roman-kashitsyn
roman-kashitsyn / cmakedocset.py
Created January 29, 2014 14:57
Generates a docset from cmake --help-html output
#!/usr/bin/env python
import sys, os
from lxml import etree
from contextlib import closing
import subprocess
import sqlite3
import shutil
DIR = 'CMake.docset'