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 stack | |
-- stack --resolver lts-3.11 --install-ghc runghc --package array --package containers | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import qualified Data.ByteString.Char8 as B | |
import qualified Data.IntMap.Strict as IM | |
import qualified Data.Map.Strict as M | |
import qualified Data.Sequence as Seq | |
import Data.Sequence ((<|), (><)) |
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
#!./stack | |
-- stack --resolver lts-2.14 --install-ghc runghc --package hspec --package QuickCheck | |
module Carrotland where | |
import Data.List (sort, find, partition) | |
import Data.Maybe (fromMaybe) | |
type Point = (Integer, Integer) | |
-- projection of a segment on X and Y axes, respectively |
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
#!/bin/bash | |
which stack > /dev/null | |
if [ $? -ne 0 ]; then | |
if [ ! -f ./.stack/stack ]; then | |
OS=`uname` | |
if [ $OS == "Darwin" ]; then | |
STACK_URL=https://github.com/commercialhaskell/stack/releases/download/v0.1.3.1/stack-0.1.3.1-x86_64-osx.gz | |
elif [ $OS == "Linux" ]; then | |
STACK_URL=https://github.com/commercialhaskell/stack/releases/download/v0.1.3.1/stack-0.1.3.1-x86_64-linux.gz | |
else |
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
#!/bin/bash | |
# this script recodes phone videos to a lower bitrace encoding to save space. | |
# phones typically encode at a very high bitrate because they don't have enough | |
# CPU power to do a more compressed encoding in real time. | |
# generally this recoding does not affect perceived video quality. | |
# USAGE: encodevid.sh [path] | |
QUALITY=26.0 | |
INPATH=$1 |
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 Test = | |
open System | |
open System.Diagnostics | |
let bench (actionFactory : unit -> (unit -> unit), | |
minIterations : int option) = | |
let minIterations = defaultArg minIterations 1 | |
let properTime (action : unit -> unit) |
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
let shouldMatch f x = | |
try f x |> ignore | |
with :? MatchFailureException as e -> | |
failwithf "Did not expect %A" x | |
[<Test>] | |
let ``something should something`` () = | |
some "complicated" (funct "call") | |
|> shouldMatch (function | This (That _) _ And (These "things") -> ()) |
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
namespace Ninject | |
{ | |
public static class NinjectExtensions | |
{ | |
private class DynKernel : DynamicObject | |
{ | |
private readonly IKernel kernel; | |
public DynKernel(IKernel inner) | |
{ |
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
@echo off | |
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -q -vf "%1" > NUL | |
if ERRORLEVEL 1 goto NOT_SIGNED | |
:SIGNED | |
echo Already signed: %~nx1 | |
goto END | |
:NOT_SIGNED |
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 Jekyll | |
class MarkdownBlock < Liquid::Block | |
def initialize(tag_name, text, tokens) | |
super | |
end | |
require "kramdown" | |
def render(context) | |
content = super | |
"#{Kramdown::Document.new(content).to_html}" | |
end |
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
open System.IO | |
open System.Net | |
let wc = new WebClient() | |
let trainingSetFile = Path.Combine( __SOURCE_DIRECTORY__, "trainingSet.csv") | |
File.WriteAllText(trainingSetFile, | |
contents = wc.DownloadString("http://brandewinder.blob.core.windows.net/public/trainingsample.csv") | |
) |