Skip to content

Instantly share code, notes, and snippets.

View jonathanjouty's full-sized avatar

Jonathan Jouty jonathanjouty

  • Cambridge, UK
View GitHub Profile
@jonathanjouty
jonathanjouty / testRnd.hs
Created March 6, 2012 19:11
Shouldn't this be what you need?
import System.Random
-- Test validity of function on a given number of random tests.
testRandom :: Random a => StdGen -> Int -> (a -> Bool) -> Bool
testRandom gen n f = all f generated
where generated = take n $ randoms gen
-- Examples of use in GHCi:
-- r <- getStdGen
-- testRandom r 100 ((\a -> a==a) :: Int -> Bool)
@jonathanjouty
jonathanjouty / gist:3086205
Created July 10, 2012 21:01 — forked from kowey/gist:2420144
Haskell GTK on 64 bit MacOS X

Notes

  • on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :)
  • Tested on Mac OS X 10.7.4, GHC 7.4.1, 64bit Haskell Platform 2012.2.0.0 (installer package) with Command Line Tools for XCode (June 2012).
  • These notes were originally brought to you by Carter Schonwald; the “I” probably refers to him. Eric Kow will refer to himself in the third person).
  • Forked from kowey (Eric Kow): https://gist.github.com/2420144

Steps

@jonathanjouty
jonathanjouty / installing-ghc7.6.1-osx10.8.md
Created October 17, 2012 11:24 — forked from beastaugh/installing-ghc7.2-osx10.7.md
Installing GHC 7.6.1 on Mac OS X 10.8 Mountain Lion

Installing GHC 7.6.1 on Mac OS X

This is a brief and bare-bones guide to getting GHC 7.6.1 and the cabal-install tool (the two basic things you'll need to do Haskell development) up and running on Mac OS X 10.8 install.

The instructions given here worked for me, but YMMV.

Original on https://gist.github.com/1169332

@jonathanjouty
jonathanjouty / ShakeTry.hs
Created July 23, 2016 10:42
Checking `Exception` type with `shakeArgs`
import Control.Exception
import Data.Typeable
import Development.Shake
import System.IO
main :: IO ()
main = do
print "Starting..."
shakeArgs shakeOptions myRules `catch` things
where
@jonathanjouty
jonathanjouty / Main.hs
Last active August 30, 2016 20:42
Servant Echo PlainText to JSON
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Data.Proxy
@jonathanjouty
jonathanjouty / ShakeExceptionTest.hs
Created August 31, 2016 14:12
Shake Exception Test
import Control.Exception
import Data.Typeable
import Development.Shake
import System.IO
import System.Environment
main :: IO ()
main = do
print "Starting..."
withArgs ["--exception"] (shakeArgs shakeOptions myRules) `catch` things

Lesson 3

Previously

  1. Basic types (int, float, complex, bool)
  2. Container types (str, list, dict)
  3. Control flow: for/range and if/elif/else

Some things to remember:

'''
A Recurrent Neural Network (LSTM) implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Long Short Term Memory paper: http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function

Keybase proof

I hereby claim:

  • I am jonathanjouty on github.
  • I am jonathanjouty (https://keybase.io/jonathanjouty) on keybase.
  • I have a public key ASCgrnHkOuw2NAXfwNDnZ2PSktqLoVO85NK5o_XOJsr7Uwo

To claim this, I am signing this object:

@jonathanjouty
jonathanjouty / aeson-benchmark-auto-compare-modified-hand-written.html
Last active May 12, 2020 20:57
aeson-benchmark-auto-compare-modified-hand-written.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>criterion report</title>
<script language="javascript" type="text/javascript">
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement