Skip to content

Instantly share code, notes, and snippets.

- 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,
--
-- A simple test for index-function generalization across a for loop
-- ==
-- input { [0, 1000, 42, 1001, 50000] }
-- output { 52043i32 }
-- structure gpu { Copy 0 }
let main [n] (a: [n]i32): i32 =
let b = loop xs = a[1:] for i < n / 2 - 2 do
xs[i:] -- This will result in a copy, but it needn't
in reduce (+) 0 b
f :: [a] -> [a]
f (x:x':xs) = x':x:xs
f xs = xs
import Data.List
import Text.Printf
type Point = (Int, Int)
ccw :: Point -> Point -> Point -> Int
ccw p1 p2 p3 = (fst p2 - fst p1) * (snd p3 - snd p1)
- (snd p2 - snd p1) * (fst p3 - fst p1)