This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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=$? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
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. | |
-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
# Accepts a grid size, and a list representing the grid. 131 | |
# characters. RUNS UNDER STRICTURES BABY YEAH. | |
my$life=sub{$a=shift;map{$b=$_[$_];my$n;$n+=$_[$_]for($_-$a-1..$_-$a+1,$_-1,$_+1,$_+$a-1..$_+$a+1);$n+$b==3||$b&&$n==4||0}0..$#_}; | |
my $result = join '', $life->( 5, qw/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require parser-tools/lex | |
(prefix-in re- parser-tools/lex-sre) | |
parser-tools/yacc) | |
(provide (all-defined-out)) | |
(define-tokens a (NUM VAR)) | |
(define-empty-tokens b (+ - EOF LET IN)) | |
(define-lex-trans number | |
(syntax-rules () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Maybe | |
import Text.Printf | |
import Control.Applicative | |
data Expr = Term Int | Op Operator Expr Expr | Var String | |
deriving (Show, Eq) | |
data Operator = Sum | Mult | Sub | Div | |
deriving (Show, Eq) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module monad scheme | |
(require "curry.ss") | |
;; i'm too lazy to repeat this pattern for now. | |
(define-syntax init-public | |
(syntax-rules () | |
((_) (begin)) | |
((_ (m default) ms ...) (begin | |
(init-field (m default)) | |
(public (internal-m m)) | |
(define (internal-m . rest) (apply (get-field m this) rest)) |
NewerOlder