Skip to content

Instantly share code, notes, and snippets.

Issac Trotts ijt

  • Oakland, CA
Block or report user

Report or block ijt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ijt /
Created Oct 3, 2019
Rust program to compute the trigram Jaccard similarity between two strings
//! The stringsim program prints out the trigram similarity of two strings
//! using what appears to be the same algorithm used by Postgres.
use std::collections::HashSet;
use std::hash::Hash;
fn main() {
let args: Vec<String> = ::std::env::args().collect();
if args.len() != 1+2 {
ijt / gofast_issue_28.go
Created Jul 20, 2018
Repro case for gofast issue 28
View gofast_issue_28.go
// This program spins up php-fpm in the background and a Go web server sending
// all requests to a PHP router script.
package main
import (
View mfilt
#!/usr/bin/env python
import argparse
import re
import sys
parser = argparse.ArgumentParser(description=
'''Filter some text with a regex, allowing matches to span multiple lines.
This tool is based on some ideas from Rob Pike's Sam editor:
ijt / sieve.clj
Last active Feb 21, 2016
Translation of the Go prime sieve to Clojure
View sieve.clj
;; A concurrent prime sieve translated from
;; by Issac Trotts with help from Chris Murphy and glts on Stack Overflow.
(require '[clojure.core.async :as async :refer [<! >! <!! chan go]])
(defn generate-naturals
"Sends the sequence 2, 3, 4, ... to channel 'ch'."
ijt / sieve.erl
Last active Feb 20, 2016
Translation of the Go prime sieve to Erlang
View sieve.erl
#!/usr/bin/env escript
%% -*- mode: erlang -*-
%%! -smp enable -hidden
%% A concurrent prime sieve, inspired by the Go prime sieve
%% with daisy-chained filter processes.
%% Translated by Issac Trotts (2016)
%% with help from Amiramix on StackOverflow.
ijt / quine.go
Created Nov 7, 2012
A quine in Go
View quine.go
package main
import "fmt"
func main() {
s := "package main\n\nimport \"fmt\"\n\nfunc main() {\n\ts := %#v\n\tfmt.Printf(s, s)\n}\n"
fmt.Printf(s, s)
ijt / splat.go
Created Oct 26, 2012
Argument splatting in Go
View splat.go
// See
package main
import "fmt"
func main() {
args := []int{1, 2, 3}
ijt / focus.go
Created Oct 8, 2012
Web proxy that disallows distracting websites
View focus.go
package main
import (
ijt / SwapElts.hs
Created Mar 10, 2012
Swap two elements of a list in Haskell, with a QuickCheck test
View SwapElts.hs
module SwapElts where
-- If you have to use this function, arrays may be a better choice.
swapElts i j ls = [get k x | (k, x) <- zip [0..length ls - 1] ls]
where get k x | k == i = ls !! j
| k == j = ls !! i
| otherwise = x
-- This is a nice example of how to efficiently generate test cases.
-- A naive approach would have been to take separate arguments for
ijt / check_balance.hs
Created Feb 18, 2012
Check for balanced parentheses in a SQL statement
View check_balance.hs
#!/usr/bin/env runhaskell
{-# LANGUAGE TemplateHaskell #-}
import Test.QuickCheck ((==>), Property)
import Test.QuickCheck.All (quickCheckAll)
-- main = interact $ show . checkBalance
main = $quickCheckAll
checkBalance :: String -> Bool
You can’t perform that action at this time.