Skip to content

Instantly share code, notes, and snippets.

@brymck
brymck / cusip.clj
Created May 19, 2014 00:03
Appends the check digit to a CUSIP
;; Example usage:
;; (cusip "ABCD1234")
;; => "ABCD12348"
(use '[clojure.string :as string])
(defn clean-cusip
"Converts a string into an unchecked 8-character CUSIP, padding with '0' if
necessary"
[s]
@brymck
brymck / trigramfuzzyset.py
Last active April 28, 2018 17:12
Fairly fast trigram fuzzy set implementation
# based on fuzzyset but considerably optimized to focus on trigrams and cosine similarity and be immutable through public
# interfaces after initialization
import re
from math import sqrt
from operator import itemgetter
from collections import defaultdict
_non_word_sub = re.compile(r'[^\w, ]+').sub
class TrigramFuzzySet(object):
@brymck
brymck / buildkite-bazel.sh
Last active September 18, 2020 07:43
Install Buildkite with Bazel on an EC2 instance
# I use the Amazon Linux 2 AMI on a t3.medium (2 vCPU, 4 GiB memory) instance attached to a 20 GB volume
#-----------------------------------------------------------------------------------------------------------------------
# Configuration
#-----------------------------------------------------------------------------------------------------------------------
# This is the token you get from going to
# https://buildkite.com/organizations/your-organization/agents
# and clicking Reveal Agent Token
export BUILDKITE_AGENT_TOKEN=foo
@brymck
brymck / buildkite-bazel-gce.sh
Last active August 31, 2020 07:16
Install Buildkite with Bazel on GCE
# I'm using a Debian 9 image on an n1-standard-1 machine type
#-----------------------------------------------------------------------------------------------------------------------
# Configuration
#-----------------------------------------------------------------------------------------------------------------------
# This is the token you get from going to
# https://buildkite.com/organizations/your-organization/agents
# and clicking Reveal Agent Token
BUILDKITE_AGENT_TOKEN=foo