Skip to content

Instantly share code, notes, and snippets.

@magthe
magthe / msys2.reg
Created September 11, 2014 06:56
MSYS2 "Open Here" registry settings
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
@="Open MSYS2 here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2\command]
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
@="Open MSYS2 here"
@merijn
merijn / MyState.hs
Last active January 15, 2021 19:20
MyState homework
data MyState s a = MyState (s -> (a, s))
get :: MyState s s
get = undefined
put :: s -> MyState s ()
put = undefined
modify :: (s -> s) -> MyState s ()
modify = undefined
@romainl
romainl / deprecation.md
Last active February 24, 2022 02:42
Idiomatic vimrc
@danbst
danbst / brainfuck.hs
Last active August 29, 2015 14:00
Simple BF interpreter in 38 lines - check http://ideone.com/aLrtPu for online test
{-# LANGUAGE MultiWayIf, BangPatterns #-}
import Data.Word
import Data.Char
data Tape = Tape { negatives :: [Word8], currentTape :: !Word8, positives :: [Word8] }
mkTape = Tape (repeat 0) 0 (repeat 0)
shiftLeft (Tape (x:left) curr right) = Tape left x (curr:right)
shiftRight (Tape left curr (x:right)) = Tape (curr:left) x right
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active April 29, 2024 09:09
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@paf31
paf31 / Juggling.elm
Last active December 17, 2015 16:29
Juggling in Elm
pauseTime = 0.35
timePerThrow = 300
handMovement = 0.2
pattern = [5]
rotatePattern : Int -> [a] -> [a]
rotatePattern n xs =
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
module Liars where
import Control.Monad
import Data.List
data Person = Truthteller | Liar deriving (Show, Eq)
says :: Person -> Bool -> Bool
says Truthteller = id
says Liar = not
@heiths
heiths / mayaOnUbuntu.sh
Last active February 28, 2024 18:50
Shell script to install and setup Autodesk Maya 2014 on Ubuntu 13.04
#!/bin/bash
#Heith Seewald 2012
#Feel free to extend/modify to meet your needs.
#Maya on Ubuntu v.1
#This is the base installer... I’ll add more features in later versions.
#if you have any issues, feel free email me at heiths@gmail.com
#### Lets run a few checks to make sure things work as expected.
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
@aztek
aztek / Functor.v
Created June 11, 2012 17:11
Coq Functor type class with statically checked functor laws
Require Import Coq.Program.Basics.
Require Import Coq.Program.Syntax.
Require Import Coq.Init.Datatypes.
Require Import Coq.Unicode.Utf8.
Open Local Scope program_scope.
Open Local Scope list_scope.
Open Local Scope type_scope.
Class Functor (φ : Type → Type) := {