Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile

Totality

all operations are 'T -> 'T
counter example: for rational numbers sqrt(2) produces an irrational number

Associativity

(a * b) * c = a * (b * c)
counter example: (a - b) - c <> a - (b - c)

Identity

there exists some data where the operation does nothing
counter example: 
addition for the natural numbers. 
@voronoipotato
voronoipotato / gpg-guide.sh
Last active May 23, 2023 15:27
A brief guide for using GPG to sign files
# This guide is a living document, if you see something outdated please fix it.
# To make a key use this.
# Defaults used to be not so good, but now they're okay for most people.
# It may not be a bad idea though to select an expiration date so that in the future you can make a new key with updated encryption
# Make sure to provide an email and proper name that people will know you as.
# If you're using this for more than just sending gossip between friends make sure to use a passphrase.
gpg --full-generate-key
# To write the signature you can use this
# I'm vopo, so if you see that, it's me. You can put your own name in there
@voronoipotato
voronoipotato / readme.md
Created December 9, 2022 04:03 — forked from josefnpat/readme.md
Going from Lua 5.2 to PICO-8's Lua

This information applies to the PICO-8 0.1.6 release.

This document is here to help folks with a proficiency in Lua understand the limitations and discrepencies between Lua and PICO-8's Lua.

You can always view the manual or yellowafterlife's extended 0.1.1 manual.

General

  • anything written in uppercase the PICO-8 editor or .p8 is made lowercase by the editor. → editing the .p8 file directly can work
  • print(function() end) outputs the string function instead of the string function: 0x0000000.
// Link: http://fssnip.net/7U0
// Posted: 5 years ago
// Author: Evgeniy Andreev
// Tags: #active patterns , #srtp
let inline (|HasLength|) x =
fun () -> (^a: (member Length: int) x)
// `this` is optional here, just for demonstration of `as` pattern
let inline length (HasLength f as this) = f()
@voronoipotato
voronoipotato / srtp.fsx
Created October 15, 2022 17:22 — forked from michaeloyer/srtp.fsx
F# SRTP Example
// SRTP: Statically Resolved Type Parameters
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters
// SRTP Allows for pulling members out of types that where the member is named and typed the same
// In this example SRTP will be used to pull out the 'First: string' and 'Last: string' members
// from different types
// One example of SRTP in the F# Base Class Library is the (+) operator.
// You'll see that it has this type signature:
@voronoipotato
voronoipotato / hex2text.fsx
Created September 2, 2022 22:04
script that is both a powershell script, and a f# script, that invokes the F# script
#if false
return dotnet fsi --quiet --exec --use:"$(Get-Location)\$($MyInvocation.MyCommand.Name)" -- $args
#endif
// <#
//the first argument is the script name, so we get the tail
let args : string array = fsi.CommandLineArgs |> Array.tail
let hexByteToAscii (s:string) =
System.Convert.ToByte(s,16)
|> System.Convert.ToChar
@voronoipotato
voronoipotato / .bashrc
Last active December 21, 2022 20:35
dotfiles for git bash
alias _="declare -F | grep -v _; alias;"
alias we="curl -s 'wttr.in/{Raleigh,Chicago,Los_Angeles,Austin}?format=3'"
alias ll='ls -lh'
alias gh='history|grep'
alias vs='"C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/devenv.exe"'
_userpass='user:pass'
_jira_domain='http://jira.domain'
_proget_domain='https://proget.domain'
function b (){
@voronoipotato
voronoipotato / anagram.fs
Created July 7, 2021 00:40
The weird way to find anagrams
// Learn more about F# at http://fsharp.org
open System
open System.Globalization
open System.Numerics
open System.Diagnostics
open System.Text
[<EntryPoint>]
let main argv =
data:text/html;base64,PCFET0NUWVBFIGh0bWw+IDxodG1sIGRhdGEtdXNlcmFnZW50PSJNb3ppbGxhLzUuMCAoV2luZG93cyBOVCAxMC4wOyBydjo4Mi4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzgyLjAiPjwhLS0KIFBhZ2Ugc2F2ZWQgd2l0aCBTaW5nbGVGaWxlIAogdXJsOiBodHRwczovL2l0dHkuYml0dHkuc2l0ZS9lZGl0IAogc2F2ZWQgZGF0ZTogVHVlIE9jdCAxMyAyMDIwIDExOjQwOjIxIEdNVC0wNDAwIChFYXN0ZXJuIERheWxpZ2h0IFRpbWUpCi0tPjxtZXRhIGNoYXJzZXQ9dXRmLTg+CjxtZXRhIG5hbWU9dmlld3BvcnQgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoIj4KPHRpdGxlPml0dHkuYml0dHk8L3RpdGxlPgo8c2NyaXB0IHNyYz0iZGF0YTp0ZXh0L2phdmFzY3JpcHQ7YmFzZTY0LGRtRnlJR1U5Wm5WdVkzUnBiMjRvS1hzaWRYTmxJSE4wY21samRDSTdablZ1WTNScGIyNGdjaWhsTEhJcGUzQnZjM1JOWlhOellXZGxLSHRoWTNScGIyNDZlSFFzWTJKdU9uSXNjbVZ6ZFd4ME9tVjlLWDFtZFc1amRHbHZiaUIwS0dVcGUzWmhjaUJ5UFZ0ZE8zSmxkSFZ5YmlCeVcyVXRNVjA5ZG05cFpDQXdMSEo5Wm5WdVkzUnBiMjRnYnlobExISXBlM0psZEhWeWJpQnBLR1ZiTUYwcmNsc3dYU3hsV3pGZEszSmJNVjBwZldaMWJtTjBhVzl1SUc0b1pTeHlLWHR5WlhSMWNtNGdkU2grZmsxaGRHZ3ViV0Y0S0UxaGRHZ3ViV2x1S0dWYk1WMHZUM1FzTWpFME56UTRNelkwTnlrc0xUSXhORGMwT0RNMk5EZ3BKbjUrVFdGMGFDNXRZWGdvVFdGMGFDNX
#r "../_lib/Fornax.Core.dll"
#load "layout.fsx"
open Html
let about = "Alan was here,fight me"
let generate' (ctx : SiteContents) (_: string) =
let siteInfo = ctx.TryGetValue<Globalloader.SiteInfo> ()
let desc =