Skip to content

Instantly share code, notes, and snippets.

View maacl's full-sized avatar

Martin Clausen maacl

View GitHub Profile
@maacl
maacl / dates.clj
Created December 7, 2022 23:53
Date fun
shadow.user> (->
(t/local-date 2004 2 29)
(t/plus (t/years 1) (t/days 1)))
;; => #object[java.time.LocalDate 0x75a742c8 "2005-03-01"]
shadow.user> (->
(t/local-date 2004 2 28)
(t/plus (t/years 1) (t/days 1)))
;; => #object[java.time.LocalDate 0x12132de3 "2005-03-01"]
shadow.user> (->
(t/local-date 2004 2 29)
@maacl
maacl / .clj
Created December 8, 2022 22:05
AoC 2022 Day 7
(ns aoc2022.day7
(:require
[clojure.string :as str]
[clojure.zip :as z]
[clojure.core.match :refer [match]]))
(defn process-line
[tree line]
(match line
["$" "cd" ".."]
@maacl
maacl / day9.clj
Last active December 9, 2022 15:38
AoC 2022 - Day 9
(ns aoc2022.day9
(:require
[clojure.string :as str]))
(def pos {0 0 1 1 2 1 -1 -1 -2 -1})
(def dirs {"U" [1 0] "R" [0 1] "D" [-1 0] "L" [0 -1]})
(defn move [pos move] (mapv + pos move))
(defn diff [pos1 pos2] (mapv - pos2 pos1))
(defn touching? [d] (#{[0 1] [1 0] [1 1] [0 0]} (mapv abs d)))
(defn positions [f moves] (reductions f [0 0] moves))
@maacl
maacl / feigenbaum.cljs
Created August 9, 2023 19:55
Feigenbaum
;; # Feigenbaum
^{:nextjournal.clerk/toc true}
(ns maacl.feigenbaum
(:require [mentat.clerk-utils.show :refer [show-sci]]
[nextjournal.clerk :as clerk]))
(clerk/eval-cljs
'(do (require '[reagent.core :as reagent])
(require '[mathbox.core :as mathbox])
@maacl
maacl / bash
Created September 3, 2023 13:33
Failed to build OpenGL-2.11.1.0.
Failed to build OpenGL-2.11.1.0.
Build log (
C:\cabal\logs\ghc-9.2.8\OpenGL-2.11.1.0-912fa12edba830b2fe688526562793497a79aee5.log
):
Preprocessing library for OpenGL-2.11.1.0..
Building library for OpenGL-2.11.1.0..
[ 1 of 119] Compiling Graphics.Rendering.OpenGL.GL.BlendingFactor ( src\Graphics\Rendering\OpenGL\GL\BlendingFactor.hs, dist\build\Graphics\Rendering\OpenGL\GL\BlendingFactor.o )
[ 2 of 119] Compiling Graphics.Rendering.OpenGL.GL.BufferMode ( src\Graphics\Rendering\OpenGL\GL\BufferMode.hs, dist\build\Graphics\Rendering\OpenGL\GL\BufferMode.o )
[ 3 of 119] Compiling Graphics.Rendering.OpenGL.GL.ComparisonFunction ( src\Graphics\Rendering\OpenGL\GL\ComparisonFunction.hs, dist\build\Graphics\Rendering\OpenGL\GL\ComparisonFunction.o )
[ 4 of 119] Compiling Graphics.Rendering.OpenGL.GL.DataType ( src\Graphics\Rendering\OpenGL\GL\DataType.hs, dist\build\Graphics\Rendering\OpenGL\GL\DataType.o )