Skip to content

Instantly share code, notes, and snippets.

Gatlin Johnson gatlin

Block or report user

Report or block gatlin

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
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Large Type</title>
<link rel="stylesheet/less" type="text/css" href="style.less">
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="lib/less.min.js"></script>
</head>
<body>
<div class="out"><span contenteditable autofocus>*hello*</span></div>
@twanvl
twanvl / machinesbench.hs
Created Jun 7, 2016
Machines benchmark modified to include vector stream fusion. Addapted from https://gist.github.com/michaelt/f19bef01423b17f29ffd, which is in turn based on https://github.com/ekmett/machines/blob/master/benchmarks/Benchmarks.hs
View machinesbench.hs
{-#LANGUAGE NoMonomorphismRestriction #-}
module Main (main) where
import Control.Monad (void)
import Control.Monad.Identity
import Criterion.Main
import qualified Data.Conduit as C
import qualified Data.Conduit.Combinators as CC
import qualified Data.Conduit.List as C
import qualified Data.Machine as M
@tonyg
tonyg / monad.rkt
Last active Sep 9, 2016
Monads in Racket
View monad.rkt
#lang racket/base
;; Monads in Racket, including polymorphic bind, return and fail.
;; Haskell-like do-notation.
(provide define-monad-class
(struct-out monad-class)
monad?
gen:monad
monad->monad-class
determine-monad
@jozefg
jozefg / closconv.lhs
Last active May 29, 2019
Tutorial on Closure Conversion and Lambda Lifting
View closconv.lhs
This is my short-ish tutorial on how to implement closures in
a simple functional language: Foo.
First, some boilerplate.
> {-# LANGUAGE DeriveFunctor, TypeFamilies #-}
> import Control.Applicative
> import Control.Monad.Gen
> import Control.Monad.Writer
> import Data.Functor.Foldable
@thomasfr
thomasfr / autossh.service
Last active Oct 2, 2019
Systemd service for autossh
View autossh.service
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@Fuuzetsu
Fuuzetsu / hackagedocs
Last active Apr 9, 2016
Script for generating and uploading missing documentation for your Hackage packages. Now with fixed package links and contents page.
View hackagedocs
#!/usr/bin/env bash
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
--contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
@pauloricardomg
pauloricardomg / cors.nginxconf
Last active Oct 6, 2019
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
View cors.nginxconf
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@timjb
timjb / cloud-haskell-operational-transformation.hs
Created Oct 14, 2012
Simulation of Operational Transformation with Cloud Haskell
View cloud-haskell-operational-transformation.hs
{-
This is a simple simulation of OT with Cloud in which all slaves generate
and apply random operations. It should work in theory. In practice, however
I wasn't apply to test it because my installation of distributed-process is
apparently broken. Specifically, `spawn` doesn't seem to work (I tested it
with some examples from the Well-Typed blog).
This code depends on https://github.com/timjb/haskell-operational-transformation.
-}
View factor.hs
npto :: (Integral a) => a -> [a]
npto x = [2,3] ++ concat [[x*6-1,x*6+1] | x <- [1..n]]
where n = ((+1) . round . sqrt . fromIntegral $ x) `div` 6
factors :: (Integral a) => a -> [a]
factors 1 = []
factors x = least : factors (x `div` least)
where least = head $ fs ++ [x]
fs = filter ((==0) . mod x) . npto $ x
@rsimoes
rsimoes / linearly-typed.pl
Created Feb 22, 2012
Long-winded linearly typed variables
View linearly-typed.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dump;
use Data::Alias "alias";
use Scalar::Util qw(weaken isweak);
my $foo = ["a".."z"];
alias my @bar = @$foo;
You can’t perform that action at this time.