Skip to content

Instantly share code, notes, and snippets.

View bookshelfdave's full-sized avatar

Dave Parfitt bookshelfdave

  • Buffalo NY
View GitHub Profile
@strcrzy
strcrzy / gist:1362706
Created November 13, 2011 21:03 — forked from danking/gist:1068185
A very simple example showing how to use Racket's lexing and parsing utilities
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM))
(define-empty-tokens b (+ - EOF))
(define-lex-trans number
(syntax-rules ()
-module(timeit).
-compile(export_all).
%% @doc Dynamically add timing to MFA. There are various types of
%% timing.
%%
%% all - time latency of all calls to MFA
%%
%% {sample, N, Max} - sample every N calls and stop sampling after Max
%%

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@bookshelfdave
bookshelfdave / riak_ycsb.md
Last active October 8, 2015 13:58
Testing the Riak YCSB

#Testing the Riak YCSB Implementation ###To build:

# Dependencies: Maven, Java 1.6+
git clone https://github.com/metadave/YCSB.git
cd YCSB
mvn clean package
# see if the build worked using the "basic" driver (ie not Riak)
./bin/ycsb load basic -P workloads/workloada
./bin/ycsb run basic -P workloads/workloada

Add mechanism to indicate if objects were dropped and a fullsync is needed

Several new stats added:

rt_source_errors - non-persistent
rt_sink_errors   - non-persistent (sink errors detected on the *source* side)
rt_dirty         - persistent across restarted, cleared by a successful fullsync
@andelf
andelf / beam_decompile.erl
Created March 19, 2013 03:25
Erlang BEAM file decompile to .erl file
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
@zeeshanlakhani
zeeshanlakhani / eqc_statem.md
Created July 13, 2015 18:26
Andrew Stone's Great eqc_statem notes

Testing Stateful Code

So far, all the properties we have written have tested stateless code. Stateless code is made up of pure functions and is inherently easier to test than stateful code with side effects. The chief problem with testing stateful code is that the input to output mapping depends on the current state of the program. Previous operations can cause the same function to return different output given the same input. Therefore, in order to test stateful code, our tests must maintain some state of their own. This state is known as the model state and is updated as part of the testing process.

@Avaq
Avaq / combinators.js
Last active June 22, 2024 19:27
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@glogiotatidis
glogiotatidis / remove-gpg-user.sh
Created May 24, 2016 11:50
Git-crypt remove user.
#!/bin/bash
#
# Script to remove GPG key from git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.