Skip to content

Instantly share code, notes, and snippets.

View knuton's full-sized avatar
🌱

Johannes Emerich knuton

🌱
View GitHub Profile
@knuton
knuton / Loadable.elm
Last active May 5, 2022 15:17
Render SVG to PNG from Elm via ports
module Loadable exposing
( Loadable(..), toMaybe, withDefault, fromResult
, map, andThen, apply, map2, mapError
, isInit, isLoading, isLoaded, isError, isDone, isPending
)
{-| Model loadable values
This is inspired by: <http://blog.jenkster.com/2016/06/how-elm-slays-a-ui-antipattern.html>
@knuton
knuton / gen-art.diff
Created March 11, 2022 13:38
Non-Haskell deps for https://github.com/quchen/generative-art via Stack/Nix
diff --git a/stack.yaml b/stack.yaml
index 2cfb16b..96a236e 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -7,3 +7,6 @@ extra-deps:
- Noise-1.0.6@sha256:7eb0d021e334ca2341a9cb51eac7d6f2c76b4e4e1a27264509b38264dc202b32,1994
- data-r-tree-0.6.0@sha256:10a25ef70e6779c3bf5128cd45d033482a370ea07e92ab1c82678675de01d870,3668
resolver: lts-18.19
+nix:
+ enable: true
@knuton
knuton / nvaltalt.bash
Last active July 29, 2021 10:16
Notational Velocity/nvALT approximation using fzf, ripgrep and awk
# Bash function to approximate Notational Velocity using fzf and ripgrep.
#
# Will search for and preview matching files based on name and content, then open with $EDITOR on enter.
# Assumes Markdown files.
#
# Based on
# - https://demu.red/blog/2021/04/a-notational-velocity-stopgap-solution-for-linux/
# - https://github.com/junegunn/fzf#3-interactive-ripgrep-integration
function note() {
pushd ~/notes 1>/dev/null && \
@knuton
knuton / grouplikes.dot
Created October 18, 2020 11:57
Lattice of group-like structures
digraph G {
rankdir = BT;
node [ shape=box ];
small_cat [ label="small cat" ];
commutative_monoid [ label="commutative monoid" ];
inverse_semigroup [ label="inverse semigroup" ];
unital_magma [ label="unital magma" ];
abelian_group [ label="abelian group" ];
@knuton
knuton / install.ps1
Last active July 8, 2020 13:32
Install dividat driver as Windows service
# This script will download and install Dividat Driver as a Windows service.
## Configuration ##########################################
$releaseUrl = "https://dist.dividat.com/releases/driver2/"
$channel = "master"
$installDir = "C:\Program Files\dividat-driver"
###########################################################
$ErrorActionPreference = "Stop"
@knuton
knuton / descartes-quotes.md
Created September 27, 2017 17:40
Descartes on the Uses of Meditation

Descartes on Meditation

Themes

  1. Meditation as Experimental Introspection 🔶/MEI
  2. Meditation as Mental Purification 🔷/MMP

The coloured diamonds are for skimming, the abbreviations for textual search.

@knuton
knuton / setup-pseudo-senso.sh
Last active August 14, 2017 15:37
Script to set up a "pseudo Senso" on Raspbian
# Purpose: Set up the Senso driver to run as a Senso simulator on boot
# Requires ARMv7 or newer.
# Usage: curl -L https://git.io/vQIGb | sudo sh -e
PARENT_DIR=$(pwd)
SETUP_DIR="pseudo-senso"
DRIVER_VERSION="v0.3.2"
export DEBIAN_FRONTEND=noninteractive
@knuton
knuton / Trans.v
Created January 26, 2014 20:55
Illustration of a problem with transitive relations in Coq
Require Import Omega.
Require Import Coq.Setoids.Setoid.
Inductive trans_r : nat -> nat -> Prop :=
| trans_r_base : trans_r 0 3
| trans_r_plus : forall m n, trans_r m n -> trans_r (m+3) (n+3)
| trans_r_trans : forall m n o, trans_r m n -> trans_r n o -> trans_r m o.
Example trans_r_6_9 : trans_r 3 9.
Proof.
@knuton
knuton / software-foundations-errata.coq
Last active December 27, 2015 11:59
Collecting errata for "Software Foundations" http://www.cis.upenn.edu/~bcpierce/sf/index.html
(** Basics.v, More Exercises
"similar to the previous one but where the second hypothesis says" should simply be
"similar to the previous one but where the hypothesis says"*)
@knuton
knuton / javascript_helper.rb
Created October 19, 2013 18:53
Helper for inlining minified JavaScripts from the Rails Asset Pipeline/Sprockets
def javascript_inline_tag(asset_path)
content_tag(
:script,
raw(Uglifier.new.compile(AppName::Application.assets.find_asset(asset_path).to_s))
)
end