Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
VictorTaelin / sic.hvml
Created January 20, 2024 21:33
Symmetric Interaction Calculus in HVM2
// COMPUTATION RULES
// ===================================================
// APP | ((λx body) arg)
// X | ---------------------------------------------
// LAM | x ~ arg; body
// ===================================================
// APP | ({fst snd} arg)
// X | ---------------------------------------------
// SUP | dup #L{a,b} = arg; {(fst a) (snd b)}
// ===================================================
@VictorTaelin
VictorTaelin / implementing_fft.md
Last active April 30, 2024 05:32
Implementing complex numbers and FFT with just datatypes (no floats)

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.

@VictorTaelin
VictorTaelin / FFT.hvm
Last active May 4, 2023 02:05
fast fourier transform using only integers on HVM
(Rot (V z)) = (V (- 0.0 z))
(Rot (G x y)) = (G (Rot y) x)
(Add (V z) (V w)) = (V (+ z w))
(Add (G x y) (G w z)) = (G (Add x w) (Add y z))
(Get (V x) f) = (f x)
(Get (G x y) f) = (f x y)
Nil = λm λx (m x)
Flip (n: Nat) : Nat
Flip Nat.zero = 1n
Flip (Nat.succ Nat.zero) = 0n
Mod2 (n: Nat) : Nat
Mod2 Nat.zero = Nat.zero
Mod2 (Nat.succ n) = Flip (Mod2 n)
IsEven (n: Nat) : Type
IsEven Nat.zero = Unit
@LukeMathWalker
LukeMathWalker / audit.yml
Last active May 5, 2024 20:53
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@PurpleBooth
PurpleBooth / README.md
Last active September 8, 2023 20:52
A github workflow pipeline for rust that does test, build and deploy windows, linux and mac, creates releases, and does SemVer Versioning, and releases to a homebrew tap

Features

  • Automatically bump SemVer
  • Update a personal homebrew tap
  • Keep that pesky version in the Cargo.toml up to date
  • (From dependabot) Get new versions out as soon as possible

Assumptions

  • You don't want a changelog
@Pilotin
Pilotin / tailwindcss-postcss-autoprefixer-cssnano.md
Last active March 20, 2024 09:09
TailwindCSS + PostCSS + AutoPrefixer + CSS Nano Install

Setup

  • Create new working folder /tailwind/. Open in terminal
  • run npm init -y
  • run npm install tailwindcss @tailwindcss/custom-forms postcss-cli autoprefixer postcss-nested cssnano
  • run npx tailwind init
  • Edit tailwind.config.js and replace plugins: [], with:
plugins: [
@Boscop
Boscop / Delete Subword Backward.sublime-macro
Created March 10, 2020 07:53 — forked from Schlechtwetterfront/Delete Subword Backward.sublime-macro
Subword Delete Macros for Sublime Text. Similar to alt+delete/ alt+backspace in other software packages.
// Delete Backward.
// Put this into your user packages folder. Can be found by navigating to Preferences > Browse Packages... in Sublime Text.
// Then add something like this to your user Key Bindings.
// { "keys": ["alt+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/User/Delete Subword Backward.sublime-macro"} }
[
{
"args":
{
"by": "subwords",
"extend": true,
@tbjgolden
tbjgolden / bitwardenTidy.js
Last active December 30, 2022 23:57
Import bitwarden export json, interactive deduplicate and export bitwarden import json
const fs = require('fs');
const path = require('path');
const inquirer = require('inquirer');
const uuidv4 = require('uuid/v4');
const owasp = require('owasp-password-strength-test');
const words = new Set([...require('wordlist-english')['english/10'], ...require('wordlist-english')['english/20']]);
const thingsIDontDoAnyMore = require("./thingsIDontDoAnyMore.json");
const { items } = require('./bitwarden_export_file.json');
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type: