Skip to content

Instantly share code, notes, and snippets.

@ttesmer
ttesmer / AD.hs
Last active October 29, 2024 15:35
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
@rohitfarmer
rohitfarmer / nvim-singularity-demo.md
Last active April 25, 2024 22:29
Neovim in Singularity Container

How to run Neovim/VIM & Jupyter inside a Singularity Container for R Programming

Video tutorial at: https://youtu.be/j63OKiLpUec

Build a Singularity Container

To build a Singularity container copy the lines below to a Singularity.def recipe/definition text file and then execute sudo singularity build container.sif Singularity.def. For more information on how to build a Singularity containers follow the instructions in the README of https://github.com/rohitfarmer/singularity-defs or check out the documentation at https://sylabs.io/.

BootStrap: docker
From: debian:buster
@nmarley
nmarley / README.md
Last active March 31, 2025 22:32
Go / C++ bindings example

Go / C++ bindings example

This is an example of Go code calling to a C++ library with a C wrapper.

Build

go build  # this only ensures it compiles
@acdvorak
acdvorak / htoprc
Created January 24, 2019 21:04
htop config: collapse multiple CPU cores into one graph, display per-process memory usage, highlight binary names
# ~/.config/htop/htoprc
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 46 47 38 49 2 1
sort_key=46
sort_direction=1
hide_threads=1
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0