Skip to content

Instantly share code, notes, and snippets.

@FranchuFranchu
FranchuFranchu / SAT.hvml
Created January 9, 2024 17:36
SAT in HVM
// Boolean constructors and functions
T = λt λf t
F = λt λf f
(Id a) = a
(Not a) = λt λf (a f t)
(And a b) = (a λx(x) λx(F) b)
(Or a b) = (a λx(T) λx(x) b)
(Or3 a b c) = (Or a (Or b c))
data List = (Cons head tail) | Nil

This is a silly idea for programming language I had. I didn't give it much thought, and the syntax & edge case rules are just a placeholder.

The only structured data type is the "record".

A record is a key-value mapping. It can also be typed.

MyRecord = (
	value: Int = 0,
	other_value = value + 24
)
@FranchuFranchu
FranchuFranchu / fragment.rs
Created April 27, 2021 22:39
Example code for conrod List in rust.
// Make sure you've defined these
let mut ui: UiCell;
let ids: Ids; // struct defined in the widget_ids! macro
let strings = vec!["One", "Two", "Buckle my shoe", "Three", "Four", "Shut the door", "Five", "Six", "Pick up the sticks"];
let (mut items, mut scrollbar) = conrod_core::widget::List::flow_down(strings.len())
.x(0.).y(0.)
.w(200.).h(500.)
.scrollbar_next_to()
@FranchuFranchu
FranchuFranchu / README.md
Created March 24, 2021 18:36
Screenshot hotkeys with scrot in openbox

This allows you to use the "print screen" key to take screenshots with scrot. The snippet above is to be placed in your openbox configuration file, inside the openbox_config and keyboard tags (with the rest of the keybinds). Since I use lxde, my openbox config file is in ~/.config/openbox/lxde-rc.xml.

You can use shift to copy your screenshots to your clipboard (requires xclip).

You can use ctrl to be able to select a rectangle or a window for the screenshot.

Scrot beeps when taking a screenshot. You can prevent this by adding -z in the scrot commands.

@FranchuFranchu
FranchuFranchu / earley.gd
Created July 26, 2020 15:44
Earley parser in GDScript
extends Object
class_name Parser
# Based off https://github.com/tomerfiliba/tau/blob/master/earley3.py
class Test:
static func tostring(val):
if typeof(val) == TYPE_STRING:
##grflangid 0x01
STR_GRF_NAME:Better world cities 1.0
STR_GRF_DESCRIPTION: This NewGRF adds names for world cities with a population count higher than 100000 (w/metropolitan area). The probability of each city appearing is proportional to the square root of the population. This makes it so that cities with lower population can appear more frequently than otherwise. World city data from https://simplemaps.com/data/world-cities, it's CC-4 licensed
STR_STYLES : Better World Cities
citiesD = [
{"x": 2448.0, "y": -7648.0, "name": "Amalfi"},{"x": 22784.0, "y": -1712.0, "name": "Cagayan"},{"x": -26128.0, "y": -12800.0, "name": "Area-42"},{"x": -2048.0, "y": -10576.0, "name": "Neftegrad"},{"x": -20304.0, "y": -10432.0, "name": "Dawnstar"},{"x": 5744.0, "y": -8752.0, "name": "Nova Kakhovka"},{"x": -13440.0, "y": 8384.0, "name": "Perito Moreno"},{"x": -10592.0, "y": -512.0, "name": "Illuminauti"},{"x": 176.0, "y": -8208.0, "name": "Miramas"},{"x": -7808.0, "y": 1616.0, "name": "Juazeiro"},{"x": 5984.0, "y": 1744.0, "name": "Ancapistan"},{"x": 3632.0, "y": 6192.0, "name": "Kaapstad"},{"x": 4832.0, "y": -6992.0, "name": "Halicarnassus"},{"x": -10656.0, "y": 736.0, "name": "Lemon Town"},{"x": -2752.0, "y": -4576.0, "name": "Saint Cloud"},{"x": 27632.0, "y": 5424.0, "name": "Moree"},{"x": 3504.0, "y": 2640.0, "name": "City Toof"},{"x": 3200.0, "y": -8560.0, "name": "Beograd"},{"x": 1232.0, "y": -8288.0, "name": "Monaco"},{"x": -16688.0, "y": -3984.0, "name": "Burrito"},{"x": -16128.0, "y": -8
@FranchuFranchu
FranchuFranchu / pathfinding.js
Created December 5, 2019 23:20
barebones pathfinding
function containsObject(obj, list) {
var i;
for (i = 0; i < list.length; i++) {
if (list[i] === obj) {
return true;
}
}
return false;
@FranchuFranchu
FranchuFranchu / townlist.js
Created December 5, 2019 23:05
List of towns in EarthMC, extracted from the dynmap
citiesD = [
{"x": 2448.0, "y": -7648.0, "name": "Amalfi"},{"x": 22784.0, "y": -1712.0, "name": "Cagayan"},{"x": -26128.0, "y": -12800.0, "name": "Area-42"},{"x": -2048.0, "y": -10576.0, "name": "Neftegrad"},{"x": -20304.0, "y": -10432.0, "name": "Dawnstar"},{"x": 5744.0, "y": -8752.0, "name": "Nova Kakhovka"},{"x": -13440.0, "y": 8384.0, "name": "Perito Moreno"},{"x": -10592.0, "y": -512.0, "name": "Illuminauti"},{"x": 176.0, "y": -8208.0, "name": "Miramas"},{"x": -7808.0, "y": 1616.0, "name": "Juazeiro"},{"x": 5984.0, "y": 1744.0, "name": "Ancapistan"},{"x": 3632.0, "y": 6192.0, "name": "Kaapstad"},{"x": 4832.0, "y": -6992.0, "name": "Halicarnassus"},{"x": -10656.0, "y": 736.0, "name": "Lemon Town"},{"x": -2752.0, "y": -4576.0, "name": "Saint Cloud"},{"x": 27632.0, "y": 5424.0, "name": "Moree"},{"x": 3504.0, "y": 2640.0, "name": "City Toof"},{"x": 3200.0, "y": -8560.0, "name": "Beograd"},{"x": 1232.0, "y": -8288.0, "name": "Monaco"},{"x": -16688.0, "y": -3984.0, "name": "Burrito"},{"x": -16128.0, "y": -8
@FranchuFranchu
FranchuFranchu / data.txt
Created July 8, 2019 21:48
A program that, given a made-up word, tells you if it makes sense or not
€a
ardvark
ˆs
baci
„k
„us
†es
ƒft
ƒlone
‡s