Skip to content

Instantly share code, notes, and snippets.

@meditans
meditans / simple.hs
Created March 25, 2014 14:11
Interval analysis of a Cantus firmus
import Music.Prelude.Basic hiding (Interval)
import Music.Pitch.Common.Interval (Interval)
main :: IO ()
main = openLilypond . showAnnotations' ""
. intervalAnnotations subjectDiff
. scat $ map reify subject
subject :: [BasicPitch]
subject = [c, d, f, e, f, g, a, g, e, d, c]
@meditans
meditans / gist:d66371137814d0dc3707
Last active August 29, 2015 14:21
nix haskell configuration for cabal hacking
{ pkgs }: {
allowUnfree = true;
packageOverrides = super: let self = super.pkgs; in {
haskellPackages = super.haskellPackages.override {
overrides = self: super: {
ghc-mod = self.callPackage /home/meditans/code/haskell/ghc-mod/default.nix {};
cabal-helper = self.callPackage /home/meditans/code/haskell/cabal-helper-0.3.4.0/default.nix {};
@meditans
meditans / config.nix
Created August 6, 2015 20:47
Nix - selectively profiling libraries
{ pkgs }: {
allowUnfree = true;
packageOverrides = super: let self = super.pkgs; in {
haskellPackages = super.haskellPackages.override {
overrides = self: super: {
mkDerivation = drv: super.mkDerivation (drv // {enableLibraryProfiling = true;});
ghc-mod = self.callPackage /home/meditans/code/haskell/ghc-mod/default.nix {};
cabal-helper = self.callPackage /home/meditans/code/haskell/cabal-helper-0.3.4.0/default.nix {};
@meditans
meditans / BinTrees.hs
Last active October 23, 2015 15:10
Enumerating BinTrees by depth
import qualified Control.Monad.WeightedSearch as W
import Data.List (sortBy)
import Data.Ord (comparing)
import Control.Applicative
data BTree = Leaf | Branch BTree BTree deriving (Show, Eq)
-- I can lazily list all the btrees
btrees :: W.T Integer BTree
btrees = pure Leaf <|> W.weight 1 (Branch <$> btrees <*> btrees)
@meditans
meditans / .spacemacs
Created October 26, 2015 20:57
Spacemacs sample config (haskell+togetherly)
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; -*- mode: emacs-lisp -*-
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layer-path '()
dotspacemacs-configuration-layers '(
emacs-lisp
;; -*- mode: emacs-lisp -*-
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layer-path '()
dotspacemacs-configuration-layers '(
emacs-lisp
inverseMap grid f i = valueAtI
where iGrid = iover (itraversed <.> itraversed) const grid
valueAtI = (f iGrid) ^?! (itraversed <.> itraversed) . index i
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1
;; -*- mode: emacs-lisp -*-
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layer-path '()
dotspacemacs-configuration-layers '(
emacs-lisp