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 / http_get.go
Last active Oct 28, 2019
Example of using http.Get in go (golang)
View http_get.go
package main
import (
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 / logging_example.hs
Created Jun 29, 2011
Example of logging in Haskell
View logging_example.hs
#!/usr/bin/env runhaskell
-- This example uses the hslogger library.
-- For debugging it may be more convenient to use Debug.Trace instead since that
-- allows you to log debugging output from otherwise pure functions.
import System.IO (stderr, Handle)
import System.Log.Logger (rootLoggerName, setHandlers, updateGlobalLogger,
Priority(INFO), Priority(WARNING), infoM, debugM,
warningM, errorM, setLevel)
ijt / FfiExample.hs
Created May 11, 2011
Example of calling C from Haskell using the FFI
View FfiExample.hs
{-# LANGUAGE ForeignFunctionInterface #-}
-- Simple example of calling C from Haskell.
-- $ ghci
-- > :load FfiExample.hs
-- > c_sin pi
-- 1.2246467991473532e-16
-- $ ghc --make FfiExample.hs
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 (
ijt / random_monad_example.hs
Created Oct 3, 2011
Example of how to use the Random monad in Haskell
View random_monad_example.hs
-- cabal install MonadRandom
-- ghc random_monad_example
-- ./random_monad_example
-- The code here is stolen from a comment in the MonadRandom source code.
import Control.Monad.Random
die :: RandomGen g => Rand g Int
die = getRandomR (1,6)
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 / io_quickcheck_example.hs
Created May 11, 2011
Simple example of monadic IO with QuickCheck in Haskell
View io_quickcheck_example.hs
#!/usr/bin/env runhaskell
-- Synopsis:
-- $ cabal install QuickCheck
-- $ runhaskell io_quickcheck_example.hs
-- Author: Issac Trotts <>
import Directory
import System.Environment
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.
You can’t perform that action at this time.