Skip to content

Instantly share code, notes, and snippets.

View bitonic's full-sized avatar
🍥
bottomless pit

Francesco Mazzoli bitonic

🍥
bottomless pit
View GitHub Profile
{-# LANGUAGE BangPatterns #-}
module OrdNub (ordNub) where
import Prelude hiding (null)
-- See Note: Order of constructors
data Set a = Bin {-# UNPACK #-} !Size !a !(Set a) !(Set a)
| Tip
type Size = Int
@bitonic
bitonic / circe-color-nicks-f.el
Created November 8, 2014 15:18
circe colors
;;; circe-color-nicks-f.el --- Color nicks in the channel
;; Copyright (C) 2012 Taylan Ulrich Bayırlı/Kammer
;; Author: Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
;; This file is part of Circe.
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;;; circe-color-nicks-f.el --- Color nicks in the channel
;; Copyright (C) 2012 Taylan Ulrich Bayırlı/Kammer
;; Author: Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
;; This file is part of Circe.
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | Run starting from "begin" and ending with "end", e.g.
--
-- @
-- ./MapReduce begin 10000 &
-- ./MapReduce segment 0 10001 '127.0.0.1' 10000 &
@bitonic
bitonic / A.hs
Created January 17, 2015 14:13
The dangers of incoherence
module A where
newtype MyInt = MyInt {unMyInt :: Int}
deriving (Show)
# Makefile tweaked for Ubuntu 14.04, install gnustep and gnustep-devel first.
HC = ghc
LIBDIR = $(shell $(HC) --print-libdir)
CFLAGS = -fobjc-arc -I$(LIBDIR)/include -I$(LIBDIR)/../../includes
HCFLAGS =
LDFLAGS = -package template-haskell -package language-c-quote -package language-c-inline -L/usr/lib/GNUstep/System/Library/Libraries/ -lgnustep-base -lobjc
OBJS = Main.o Main_objc.o
@bitonic
bitonic / gist:627fb9c1a5d494372d1d
Created April 14, 2015 01:19
loop video into v4l2loopback device
#include <gst/gst.h>
#include <glib.h>
typedef struct {
GMainLoop* loop;
GstElement* pipeline;
} LoopAndPipeline;
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
{
@bitonic
bitonic / crc32.hs
Last active August 29, 2015 14:20
import Control.Exception (evaluate)
import Control.Monad (forM_)
import Control.Monad (replicateM, forM)
import qualified Data.ByteString.Lazy as BS
import qualified Data.Digest.CRC32
import qualified Data.Digest.Pure.CRC32
import System.Environment (getArgs)
import qualified System.Random.MWC as MWC
import Data.Binary (encodeFile, decodeFile)
import Data.Word (Word32)
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- PC-BSD - Fonts configurations v.12012006-->
<!-- Antialias any font by default with autohint enabled, hintfull -->
<match target="font" >
<edit mode="assign" name="antialias" >
{-# OPTIONS_GHC -F -pgmFtrhsx #-}
module Main (main) where
import Control.Monad
import Happstack.Server
import qualified Text.Blaze.Html5 as H
import Data.String (fromString)