Skip to content

Instantly share code, notes, and snippets.

CREATE TABLE `movies`.`movies_movie` (
`id` INT NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255) NOT NULL,
`year` SMALLINT NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB
CHARACTER SET utf8 COLLATE utf8_general_ci;
@aavogt
aavogt / xmonad.hs.txt
Created May 18, 2012 00:47 — forked from anonymous/xmonad.hs.txt
xmonad.hs
{-# LANGUAGE ImplicitParams, NoMonomorphismRestriction #-}
import XMonad
import Data.Monoid
import Control.Monad
import System.Exit
import XMonad.Util.Run
import XMonad.Util.WorkspaceCompare
import XMonad.Layout.PerWorkspace (onWorkspace)
@aavogt
aavogt / ZipAlign.hs
Last active December 20, 2015 09:48 — forked from tonymorris/ZipAlign.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
import Data.Foldable as F
import Data.Traversable as T
import Data.Monoid
import Control.Monad.State
@aavogt
aavogt / LiftN complicated (ghc-7.7 only)
Last active December 25, 2015 17:59
apply Control.Monad.Trans.lift a number of times
{-# LANGUAGE DataKinds, FlexibleContexts, FlexibleInstances, FunctionalDependencies, KindSignatures, MultiParamTypeClasses, OverlappingInstances, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
module LiftN_ where
import Control.Monad.Trans
import Data.Proxy
import GHC.TypeLits
{- |
>>> import Control.Monad.Reader
@aavogt
aavogt / M.hs
Created November 5, 2013 21:14
module M where
{-# LANGUAGE ViewPatterns, TemplateHaskell #-}
module HMQQ where
import Language.Haskell.TH.Quote
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import Language.Haskell.Meta
import Data.Aeson
import Control.Monad
import qualified Data.HashMap.Strict as M
@aavogt
aavogt / concat.html
Created February 5, 2014 04:17
concatenate two svgs
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="4pt" height="3pt" viewBox="0 0 450 300" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-1">
<path style="stroke:none;" d="M 1.375 -10.9375 L 6.0625 -10.9375 C 7.445312 -10.9375 8.507812 -10.625 9.25 -10 C 10 -9.382812 10.375 -8.507812 10.375 -7.375 C 10.375 -6.21875 10 -5.332031 9.25 -4.71875 C 8.507812 -4.101562 7.445312 -3.796875 6.0625 -3.796875 L 4.203125 -3.796875 L 4.203125 0 L 1.375 0 Z M 4.203125 -8.890625 L 4.203125 -5.84375 L 5.75 -5.84375 C 6.300781 -5.84375 6.722656 -5.972656 7.015625 -6.234375 C 7.316406 -6.503906 7.46875 -6.882812 7.46875 -7.375 C 7.46875 -7.851562 7.316406 -8.222656 7.015625 -8.484375 C 6.722656 -8.753906 6.300781 -8.890625 5.75 -8.890625 Z "></path>
</symbol>
<symbol overflow="visible" id="glyph0-2">
<path style="stroke:none;" d="M 1.265625 -11.390625 L 3.875 -11.390625 L 3.875 0 L 1.265625 0 Z "></path>
</symbol>
<symbol overflow="visible" id="glyph0-3">
{-# LANGUAGE ConstraintKinds, RankNTypes, TypeFamilies, FlexibleInstances #-}
{- | Description: representing functions that can be differentiated
The 'AnyRF' wrapper holds functions that can be used
for the objective (`f`) or for constraints (`g`). Many functions
in the instances provided are partial: this seems to be unavoidable
because the input variables haven't been decided yet, so you should
not be allowed to use 'compare' on these. But for now just use the
standard Prelude classes, and unimplementable functions (which
would not produce an 'AnyRF') are calls to 'error'.
@aavogt
aavogt / main.hs
Created May 1, 2014 19:29
HOpenCV contours crash
{-# LANGUAGE DataKinds #-}
module Main where
import OpenCV.ArrayOps
import OpenCV.ColorConversion
import OpenCV.Contours ( withContourList, cvMoments, cvGetHuMoments, cvDrawContours, cvContourArea )
import OpenCV.Core.CVOp ( cv )
import OpenCV.Core.CxCore
import OpenCV.Core.ImageUtil
import OpenCV.HighCV
@aavogt
aavogt / main.hs
Created May 7, 2014 20:04
opencv createVideoWriter needs a more restrictive type?
{-# LANGUAGE DataKinds #-}
module Main where
import OpenCV.HighCV
import OpenCV.Core.Image
main = do
cap <- createFileCapture "in.avi"
Just img <- cap
w <- createVideoWriter "out.avi" ('M','J','P','G') 1 (width img, height img)