Skip to content

Instantly share code, notes, and snippets.

@3noch
3noch / Geolocation.hs
Last active January 30, 2016 20:25
Reflex-DOM Geolocation
module Geoposition where
import Control.Concurrent (forkIO)
import Control.Monad.Exception (catch, throw)
import Control.Monad.IO.Class (liftIO)
import Reflex (Event)
import Reflex.Dom (MonadWidget)
import Reflex.Dom.Class (performEventAsync)
@roelvandijk
roelvandijk / Nub.hs
Last active February 7, 2016 16:51 — forked from fizruk/Nub.hs
Incredibly slow type-level Nub
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Nub where
import Data.Proxy
import Data.Type.Bool
@merijn
merijn / Scraper.hs
Created July 9, 2015 08:20
Concurrent webscraper
{-# LANGUAGE OverloadedStrings #-}
import Control.Concurrent.Async
import Control.Concurrent.QSem
import Control.Monad
import Control.Monad.Catch
import Control.Monad.Trans
import Control.Monad.Reader
import Data.ByteString.Lazy (ByteString)
@gilligan
gilligan / Xorg.0.log
Created May 25, 2015 00:26
xorg and nixos configuration files
[ 165.023]
X.Org X Server 1.16.4
Release Date: 2014-12-20
[ 165.023] X Protocol Version 11, Revision 0
[ 165.023] Build Operating System: Linux 3.12.27 x86_64
[ 165.023] Current Operating System: Linux nixoslappy 3.14.34 #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970 x86_64
[ 165.023] Kernel command line: initrd=\efi\nixos\pnhjgx3v9pkxyhqhjcxh62l2axwnwd3g-initrd-initrd.efi systemConfig=/nix/store/siybfc2y9prrwk6bab8bz8yh0460axwb-nixos-14.12.496.5f7d374 init=/nix/store/siybfc2y9prrwk6bab8bz8yh0460axwb-nixos-14.12.496.5f7d374/init loglevel=4
[ 165.023] Build Date: 01 March 2015 04:27:12AM
[ 165.023]
[ 165.023] Current version of pixman: 0.32.6
@3noch
3noch / scoped-bootstrap.nix
Last active November 4, 2016 12:46
Nix expression to build scoped Twitter Bootstrap CSS
# This expression builds a copy of Twitter Bootstrap CSS but with every rule embedded inside a CSS selector of
# your choice. This makes it easy to embed a Bootstrap-themed component in a site that doesn't use Bootstrap.
#
# Usage
# * Install nix from https://nixos.org/nix/ (it's a fancy package manager that won't mess up your system)
# * Save this file to `scoped-bootstrap.nix`
# * With nix stuff on your PATH, run `nix-build scoped-bootstrap.nix`
# * The result will be in `./result/` (a symlink). Copy to desired location.
# * If you don't want to keep `nix`: `rm -rf /nix`
@chrisdone
chrisdone / 1Core.hs
Created January 11, 2017 17:06
Xeno examples
-- RHS size: {terms: 254, types: 135, coercions: 0}
Xeno.$wparse [InlPrag=[0]]
:: GHC.Prim.Addr#
-> GHC.ForeignPtr.ForeignPtrContents
-> GHC.Prim.Int#
-> GHC.Prim.Int#
-> ()
[GblId,
Arity=4,
Str=DmdType <L,U><L,U><L,U><S,U>,
@aisamanra
aisamanra / simple_hans_server.hs
Created June 1, 2016 06:09
A basic application written using ssh-hans
module Main where
{-
Here is a real---if not particularly interesting---interaction with this server:
[gdritter@armilla ~]$ ssh -p 9999 localhost incr
ok.
[gdritter@armilla ~]$ ssh -p 9999 localhost incr
ok.
[gdritter@armilla ~]$ ssh -p 9999 localhost double
{ pkgs ? import <nixpkgs> {}}:
let
texpkgs = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small latexmk;
};
in
pkgs.stdenv.mkDerivation {
name = "mbd";
@mstksg
mstksg / the_fools_who_dream.md
Last active September 25, 2017 22:04
The Fools Who Dream
title subtitle author
The Fools Who Dream
(Computer Science Edition)
Justin Hurwitz (Lyrics Justin Le)

[Charles Babbage]

His difference engine / did multiplication
And sometimes addition by three

@imeckler
imeckler / BFS.hs
Last active October 12, 2017 01:55
BFS
{-# LANGUAGE LambdaCase #-}
import Control.Applicative
import Control.Monad.State
import System.Random
data Tree a = Empty | Bin a (Tree a) (Tree a)
deriving Show
-- O(n)