Skip to content

Instantly share code, notes, and snippets.

magthe / Part1.hs
Created Dec 18, 2017
AoC 2017, day 16
View Part1.hs
import Control.Applicative
import Data.Monoid
import Data.Vector as V
import Prelude as P
import Text.ParserCombinators.ReadP
spinList :: Int -> Vector Char -> Vector Char
spinList n xs = let (h, t) = V.splitAt (l - n) xs
l = V.length xs
in t <> h

Keybase proof

I hereby claim:

  • I am magthe on github.
  • I am magthe ( on keybase.
  • I have a public key ASCF3PyaMhJU-BVsk0bF9gjQ7DSJv5NYmbYFRvBjwJtWlgo

To claim this, I am signing this object:

View Free1.hs
{-# LANGUAGE DeriveFunctor#-}
-- Simple example of using Free with a single algebra/API.
module Free1 where
import Control.Monad.Free
data SimpleFileF a
= LoadFile FilePath (String -> a)
magthe / core.cljs
Created Apr 11, 2016
Quil load-image failing
View core.cljs
(ns bg.core
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]
[bg.image :as i]))
(println "bg.core loaded")
(defn setup []
(let [img (q/load-image i/img)]
magthe / CMakeLists.txt
Last active Mar 18, 2021
Complete example of D-BUS client and server using Qt5 and CMake.
View CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
find_package(Qt5 CONFIG REQUIRED Core DBus)
set(prog_SRCS my.test.Calculator.xml)
magthe / nooo
Created May 21, 2015
Not Only OO
View nooo
Vi upptäcker bättre sätt att utveckla mjukvara genom att göra det och genom
att hjälpa andra att göra det. Genom detta arbete har vi lärt oss värdesätta:
* *Funktioner och Typer* mer än klasser
* *Renhet* mer än mutation
* *Komposition* mer än arv
* *Högre ordningens funktioner* mer än metodbindning
* *Options* mer än nulls
Det betyder att det finns värde i sakerna till höger (förutom null), men vi
magthe / bbwp.hs
Last active Aug 29, 2015
Bye bye WordPress
View bbwp.hs
#! /usr/bin/env runhaskell
-- {{{1 imports
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Time.Format
import Data.Time.LocalTime
import System.Directory
import System.Environment
magthe / msys2.reg
Created Sep 11, 2014
MSYS2 "Open Here" registry settings
View msys2.reg
Windows Registry Editor Version 5.00
@="Open MSYS2 here"
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
@="Open MSYS2 here"
magthe / style.csl
Created Sep 10, 2014
CSL for pandoc-citeproc issue #81
View style.csl
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" page-range-format="minimal" default-locale="en-US">
<title>Journal of Combinatorics</title>
<link href="" rel="self"/>
<link href="" rel="documentation"/>
<name>Alafate Julaiti</name>
class Visitor:
def visit(self, obj):
getattr(self, 'visit_' + obj.__class__.__name__)(obj)
def visit_Tree(self, t):
def visit_Leaf(self, l):