Skip to content

Instantly share code, notes, and snippets.

maybeHead :: a -> [a] -> a
maybeHead _ (x : _) = x
maybeHead x _ = x
treeFold :: Show a => (a -> a -> a) -> a -> [a] -> a
treeFold f neutral = treeFold' []
where
treeFold' ((i1, x1) : (i2, x2) : rest) xs
| i1 == i2 = treeFold' ((i1 + 1, f x1 x2) : rest) xs
treeFold' acc (x1 : x2 : rest) = treeFold' ((0, f x1 x2) : acc) rest
@Munksgaard
Munksgaard / external-data.txt
Last active April 16, 2022 20:31
A tool to get datta from external sources, e.g. ERDA. An alternative to git-annex or LFS
.external-data/rodinia/hotspot/data/1024.in https://sid.erda.dk/share_redirect/FlhwY8rtfk/rodinia/hotspot/1024.in 3ead297c7a98339297ba0fd351aa3e364b476aac4afe9fb568271e73741adf7b
.external-data/rodinia\ 5/hotspot/data/1024.in https://sid.erda.dk/share_redirect/FlhwY8rtfk/rodinia/hotspot/1024.in 3ead297c7a98339297ba0fd351aa3e364b476aac4afe9fb568271e73741adf7b
@Munksgaard
Munksgaard / Dockerfile
Created April 7, 2022 09:48
docker with futhark
FROM nvidia/cuda@sha256:01d41694d0b0be8b7d1ea8146c7d318474a0f4a90bfea17d3ac1af0328a0830b
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y libz3-4 libz3-dev haskell-stack libtinfo-dev libgmp-dev zlib1g-dev
RUN git clone https://github.com/diku-dk/futhark
WORKDIR "futhark"
RUN stack upgrade
- SimpleDB. A basic rdbms built from scratch: https://www.awelm.com/posts/simple-db/
- Writing a SQL database from scratch in Go: https://notes.eatonphil.com/database-basics.html
- Let's Build a Simple Database: https://cstack.github.io/db_tutorial/
- Foundations of Databases: http://webdam.inria.fr/Alice/
@Munksgaard
Munksgaard / grammar.js
Created February 11, 2022 09:26
futhark tree-sitter grammar
module.exports = grammar({
name: 'futhark',
rules: {
source_file: $ => repeat($.dec),
identifier: $ => /_?[A-Za-z][A-Za-z0-9_\']*/,
_quals: $ => repeat1(
seq($.identifier, '.')
;; Emoji: 😄, 🤦, 🏴󠁧󠁢󠁳󠁣󠁴󠁿
(defun set-fonts ()
(set-fontset-font t 'symbol "Apple Color Emoji")
(set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
(set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
(set-fontset-font t 'symbol "Symbola" nil 'append))
;; run this hook after we have initialized the first time
(add-hook 'after-init-hook 'set-fonts)
;; re-run this hook if we create a new frame from daemonized Emacs
(use-package magit
:ensure t
:bind (("C-c m" . magit-status)
("C-c b" . magit-blame)
("C-x g" . magit-status)
("C-x M-g" . magit-dispatch))
:config
(setq magit-diff-options (quote ("--word-diff")))
(setq magit-diff-refine-hunk 'all)
(add-hook 'magit-mode-hook (lambda () (local-unset-key [C-tab])))
@Munksgaard
Munksgaard / skift-password.side
Created December 17, 2020 09:39
Selenium IDE script til at skifte password på KU "nok" gange til at man kan genbruge sit ønskede password.
{
"id": "7d1d2484-7d78-44f2-8727-f53b1abd21a7",
"version": "2.0",
"name": "password skift",
"url": "https://id.ku.dk",
"tests": [{
"id": "20076e95-0834-44c4-b99d-0a9caa35e30f",
"name": "ChangePassword1",
"commands": [{
"id": "4e9c8a00-e0eb-4e13-bb23-1682c4652512",
-- mat_13766 : [m_13764][m_13765]f32@@mat_mem_19100->{base: [m_13764, m_13765]; contiguous: True; LMADs: [{offset: 0i32; strides: [m_13765, 1i32]; rotates: [0i32, 0i32]; shape: [m_13764, m_13765]; permutation: [0, 1]; monotonicity: [Inc, Inc]}]}
entry {[?0][?1]f32@?2->{base: [?0, ?1]; contiguous: True; LMADs: [{offset: 0i32;
strides: [?1, 1i32];
rotates: [0i32, 0i32];
shape: [?0, ?1];
permutation: [0, 1];
monotonicity: [Inc, Inc]}]}}
main (mem mat_mem_19100, i32 m_13764, i32 m_13765,
let {bool intra_suff_and_fits_17137} =
logand(fits_14842, suff_intra_par_17136)
-- res_17138 : [j_m_i_13929][j_m_i_13929][16i32][16i32]f32@@res_mem_19455->{base: [j_m_i_13929, j_m_i_13929, 16i32, 16i32]; contiguous: True; LMADs: [{offset: 0i32; strides: [mul32 (256i32) (j_m_i_13929), 256i32, 16i32, 1i32]; rotates: [0i32, 0i32, 0i32,
0i32]; shape: [j_m_i_13929, j_m_i_13929, 16i32, 16i32]; permutation: [0, 1, 2, 3]; monotonicity: [Inc, Inc, Inc, Inc]}]}
let {mem res_mem_19455;
[j_m_i_13929][j_m_i_13929][16i32][16i32]f32 res_17138} =
-- Branch returns: {[j_m_i_13929][j_m_i_13929][16i32][16i32]f32@?0->{base: [j_m_i_13929,
-- j_m_i_13929,
--