Skip to content

Instantly share code, notes, and snippets.

Carter Tazio Schonwald cartazio

Block or report user

Report or block cartazio

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 CoData.hs
{-# LANGUAGE Rank2Types, GADTs, LambdaCase #-}
data Stream a res where
Head :: Stream a a
Tail :: Stream a (CoData (Stream a))
newtype CoData con = CoD {unCoD :: forall r. con r -> r}
appendList :: [a] -> CoData (Stream a) -> CoData (Stream a)
appendList [] s = s
@chrismdp
chrismdp / s3.sh
Last active Aug 2, 2019
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
View s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
View CLGLBuffer.hs
{-# LANGUAGE ScopedTypeVariables #-}
module Rendering.CLGLBuffer where
import Control.Parallel.CLUtil
import Foreign.Ptr (nullPtr)
import Foreign.Storable (Storable(sizeOf))
import Graphics.GLUtil.BufferObjects
import Graphics.Rendering.OpenGL (deleteObjectName, BufferObject, BufferTarget(..))
import Rendering.CLGLInterop
data CLGLBuffer a = CLGLBuffer { asVBO :: BufferObject
View orderedkv.hs
class (Ord (Key table)) => OrderedKV table where
type Key table :: *
type Value table ::*
type Address table :: *
keyRange :: table -> (Key table, Key table)
key2Address :: table -> (Key table) -> Maybe (Address table)
address2Key :: table -> (Address table) -> Key Table
nextAddress :: table -> Address table -> Maybe (Address table)
nextKey :: table -> Key table -> Maybe (Address table) ->Maybe (Key table, Address table )
View Tarjan.hs
{-# LANGUAGE RankNTypes, GADTs, PolyKinds #-}
module Tarjan where
import Control.Applicative
import Control.Category
import Data.Monoid
import Prelude hiding ((.),id)
-- Radu Mihaesau and Robert Tarjan's Catenable Deque
@copumpkin
copumpkin / Resource.hs
Last active Aug 29, 2015
Can you break my shitty linear resource monad transformer? Looking for people to find ways that it's unsafe.
View Resource.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RebindableSyntax #-}
module Resource where
@copumpkin
copumpkin / Format.hs
Last active Aug 29, 2015
A simple translation of the format combinators used in The Power of Pi (http://www.staff.science.uu.nl/~swier004/Publications/ThePowerOfPi.pdf)
View Format.hs
{-# LANGUAGE EmptyDataDecls, ExistentialQuantification, RankNTypes, GADTs, ImplicitParams, TypeFamilies, DataKinds, TypeOperators, DeriveGeneric, PolyKinds #-}
module Format where
import Prelude hiding (read)
import Data.Either
import Data.Binary.Get
import Data.Binary.Builder
import Data.Monoid
import Data.Foldable
import Control.Applicative
View gist:8789334
%====Set up Listings===============================================================
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{darkred}{rgb}{0.5,0,0}
\lstloadlanguages{Haskell}
\lstnewenvironment{code}
{ % \centering
\lstset{}%
\csname lst@SetFirstLabel\endcsname}
{ %\centering
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active Aug 23, 2019
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@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=$?
You can’t perform that action at this time.