Skip to content

Instantly share code, notes, and snippets.

View michaelklishin's full-sized avatar

Michael Klishin michaelklishin

View GitHub Profile
@samuelclay
samuelclay / radix_trie.clj
Created January 22, 2013 17:51
A Radix Trie (aka PATRICIA trie) implemented in Clojure. For my JavaScript implementation, see this interactive JS fiddle: http://jsfiddle.net/jCYAw/
(ns radix
(:require [clojure.string :as string]))
(use 'clojure.java.io)
(use 'clojure.pprint)
(println "Loading names... ")
(time (def names
(with-open
[rdr (reader
"/usr/share/dict/ProperNames")]
@coderoshi
coderoshi / gist:3729593
Last active March 31, 2022 15:43
A Very Short Guide to Writing Guides

A Very Short Guide to Writing Guides

This is just a few thoughts on the topic of writing technical guides. This was intended for Basho's engineering team, but this may apply to open source projects in general.

Audience

It's commonly preached that the first step in writing is to identify your audience; to whom are you writing? This is the most well known, most repeated, and most overlooked step of writing in general and technical writing in particular. Take this document, for example. My audience is technical people who need to communicate technical information, and not teenagers, so I shy away from images of pop icons and memes. I use jargon and words like "identify" rather than "peep this".

Pronouns

@FaKod
FaKod / gist:1331556
Created November 1, 2011 19:05
The Neo4j Matrix Example with Neo4j-Scala
/**
* The Matrix Example
* http://wiki.neo4j.org/content/The_Matrix
*/
case class Matrix(name: String, profession: String)
object TheMatrix extends App with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
ShutdownHookThread {
shutdown(ds)
@relaxdiego
relaxdiego / graphite.md
Last active January 5, 2022 09:07 — forked from surjikal/graphite.md
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

@guillaumebort
guillaumebort / 1.sql
Created May 25, 2012 15:17
Play 2.0/Anorm
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,
@prasincs
prasincs / sha1-hash.clj
Created February 15, 2011 08:36
clojure sha1 hash
(defn get-hash [type data]
(.digest (java.security.MessageDigest/getInstance type) (.getBytes data) ))
(defn sha1-hash [data]
(get-hash "sha1" data))
(defn get-hash-str [data-bytes]
(apply str
(map
#(.substring
{deps, [
{eleveldb, {git, "https://github.com/basho/eleveldb.git", {branch, "master"}}}
]}.
{overrides,
[{override, eleveldb, [
{pre_hooks, [{compile, "c_src/build_deps.sh get-deps"},
{compile, "c_src/build_deps.sh"}]},
{post_hooks, [{clean, "c_src/build_deps.sh clean"}]},
@eliaslevy
eliaslevy / gist:3042381
Created July 3, 2012 19:43
High level AMQP blocking publish method
# Helper method that publishes a message to an exchange and waits for a
# broker acknowledgement using RabbitMQ's publisher confirmation extension.
#
# Confirm mode must already be enabled in the channel. You can turn
# confirm mode on using channel.confirm_select. You must only do this
# once.
#
# It also raises an error if you use the mandatory and/or immediate
# options, and these constrains cannot be meet by the broker.
#
#!/bin/sh
#
# Downloads and installs the startssl CA certs into the global java keystore
# Author: Klaus Reimer <k@ailis.de>
#
# Check if JAVA_HOME is set
if [ "$JAVA_HOME" = "" ]
then
echo "ERROR: JAVA_HOME must be set."
@cghsystems
cghsystems / copy_blobs.rb
Created January 8, 2014 10:15
This script will replace all soft linked Bosh blobs contained in $BOSH_RELEASE_DIR/blobs with hard links. This helps solve the issue of moving blobs from a created release to a new blobstore. After this script has run `bosh blobs` should show a set of blobs ready to be uploaded to a blobstore. Note: config/blobs will probably need removed.
require 'fileutils'
require 'find'
def cp_symlink(f)
new_file = "#{f}.new"
old_file = File.readlink(f)
FileUtils.cp(old_file, new_file)
`rm -r #{f}`
File.rename(new_file, f)
puts "Processed #{f}"