Skip to content

Instantly share code, notes, and snippets.

View maacl's full-sized avatar

Martin Clausen maacl

View GitHub Profile
@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 )
@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 / 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 / .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 / 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)
http://quil.info/sketches/show/27fb47d5400dee4928303046731ff47c3b460539568af20665dc8e43fffedc07
@maacl
maacl / core.clj
Last active July 19, 2020 13:58
r/fold parallelism
(ns csv2summap.core
(:require [clojure.data.csv :as csv]
[clojure.java.io :as io]
[clojure.core.reducers :as r]))
(with-open [writer (io/writer "numbers.csv")]
(csv/write-csv
writer
(take 1000000 (repeatedly #(vector (char (+ 65 (rand-int 26))) (rand-int 1000))))))
@maacl
maacl / ray-trace.cljs
Created August 7, 2019 23:25
Simpel ray tracer in cljs/quil.
;; Converted from this: http://www.ulisp.com/list?2O52
(ns ray.core
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]))
(defn col [r g b]
[r g b])
(defn pt [x y z]
[x y z])
(defn v [x y z]
@maacl
maacl / raycast2d.cljs
Created July 15, 2019 16:12
2d raycasting using Quil
(ns my.core
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]))
(defn cast [{[x1 y1] :a [x2 y2] :b} {[x3 y3] :pos [x4 y4] :dir}]
(let [x4 (+ x3 x4)
y4 (+ y3 y4)
den (- (* (- x1 x2) (- y3 y4))
(* (- y1 y2) (- x3 x4)))]
(if-not (= 0 den)
@maacl
maacl / Module1.xba
Created September 8, 2018 10:04
Index update macro
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice: