Skip to content

Instantly share code, notes, and snippets.

View rjray's full-sized avatar

Randy J. Ray rjray

  • http://www.nvidia.com
  • San Jose, CA
  • X @rjray
View GitHub Profile
@rjray
rjray / heap.clj
Created February 17, 2018 05:06
Simple implementation of both min-heaps and max-heaps in one module.
;;; heap.clj
;;;
;;; An implementation of both min-heaps and max-heaps. Each heap is presented
;;; as a vector with the content stored from index 1. Index 0 is used to store
;;; a map that holds the functions to be used in comparing elements for the
;;; "bubble-up" and "heapify" operations.
(ns algorithms.heap)
;; Swap two elements of the given vector, using assoc! on the assumption that
;; the vector is currently transient.

Keybase proof

I hereby claim:

  • I am rjray on github.
  • I am rjray (https://keybase.io/rjray) on keybase.
  • I have a public key whose fingerprint is 386C 5D8F ABF8 EC90 8A76 072B E7A2 50D8 2FDD 3C62

To claim this, I am signing this object:

@rjray
rjray / gist:1047323
Created June 26, 2011 06:37
Running Devel::Cover over a suite of tests
cover -delete
HARNESS_PERL_SWITCHES=-MDevel::Cover=-coverage,statement,branch,condition,path,subroutine,time prove -l
cover
@rjray
rjray / inotify.pl
Created May 8, 2009 02:05
Some playing-around with the Linux::Inotify2 Perl module, for tracking what/how many files are loaded as Perl runs.
#!/usr/bin/perl
# Playing around with acme's sample code around Linux::Inotify2.
# See http://acme.vox.com/library/post/what-files-does-your-perl-load.html
use strict;
use warnings;
use Linux::Inotify2;
use File::Find::Rule;
#!/bin/bash
# I use this to create a gh-pages branch on new repos
if [ ! -d .git ]; then
echo "Must be in a repository directory!"
exit
fi
wd_clean=$(git status | grep 'nothing to commit')