This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- # Generating audio with literate Futhark | |
-- | |
-- Sound is vibrations in the air that are picked up by our ears. Vibrations | |
-- can be described using sine-curves. Computers are ultimately discrete in | |
-- nature, so in order to produce sound we have to approximate sine-curves using | |
-- sampling. Let's see how that works in practice. | |
-- We start by defining some global variables that we're going to use. | |
-- First, the volume which we wish to output at. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: all | |
all: | |
futhark c futmusic.fut | |
rm -f output.wav | |
echo "" | ./futmusic -b | tail -c+18 | head -c-1 | ffmpeg -f s8 -i - output.wav | |
mpv output.wav |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let (y: Int) = 42 | |
let (xss: [y][x]Int) = | |
kernel x <= y do | |
let (xs: [x]Int) = iota(x) | |
in (xs) | |
let (z: Int) = 42 | |
let (xs: [x]Int) = | |
if z then | |
let (x: Int) = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = grammar({ | |
name: 'futhark', | |
rules: { | |
source_file: $ => repeat($.dec), | |
identifier: $ => /_?[A-Za-z][A-Za-z0-9_\']*/, | |
_quals: $ => repeat1( | |
seq($.identifier, '.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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]))) |