Skip to content

Instantly share code, notes, and snippets.

@marijnvanwezel
marijnvanwezel / proofscript.ts
Created February 23, 2025 16:24
TypeScript as a proof assistant
// TypeScript can be used just like a proof assistant (for intuitionistic propositional logic)!
//
// Inspired by: https://www.youtube.com/watch?v=i-hRpYiNwBw
// We can encode False as the following recursive type, which can never
// be constructed (e.g. you would need { false: { false: { false: ... }}}).
type False = { false: False };
// True can be encoded as the inhabited singleton type "I", which
// has as its only inhabitant the string "I".
@rendello
rendello / _utf8_case_data.rs
Last active March 11, 2025 21:53
Unicode codepoints that expand or contract when case is changed in UTF-8. Good for testing parsers. Includes the data `utf8_case_data.rs` and the script to generate it, `generate_utf8.py`.
/*
Copyright (c) 2024 Rendello
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@m3rlinux
m3rlinux / simple-rrd-merge.py
Last active October 20, 2025 20:12 — forked from arantius/simple-rrd-merge.py
add support for python3
#!/usr/bin/env python
"""Simple script to merge multiple RRD files together.
Accepts any number of RRD file names as arguments. Produces an "rrdtool dump"
style file on stdout. The last RRD file should have a slot for every possible
record in the resulting merged RRD.
Run something like:
$ python simple-merge-rrd.py filea.rrd fileb.rrd filec.rrd | \
@RobertAKARobin
RobertAKARobin / safari.md
Last active December 5, 2024 01:38
Safari's date-picker is the cause of 1/3 of our customer support issues

Safari's date-picker is the cause of 1/3 of our customer support issues

...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date"> HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.

The context

I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.

The problem

@nonnullish
nonnullish / making-windows-11-usable.md
Last active May 12, 2025 04:37
Making Windows 11 Usable

Making Windows 11 Usable

Remove Garbage

Sophia Script for Windows

Keep in mind that if you're not careful when selecting the settings, not only will it remove the preinstalled TikTok app but also the default photo viewer. Other than that works great.

Fix Explorer and Right Click Menus

Explorer Patcher

@FlorianLatapie
FlorianLatapie / tictactoe.py
Created June 9, 2022 14:32
Simple python Tic-tac-toe using the mouse in the terminal with curses, on Windows use the command `pip install windows-curses` to install curses
import curses
# Constants
import random
KEY_ESC = 27
X = "X"
O: str = "O"
EMPTY = " "
@FlorianLatapie
FlorianLatapie / mvn_win_install.cmd
Last active November 7, 2023 13:10
Apache Maven 3.8.6 auto install script for Windows *run the script with admin privileges*
@ECHO off
REM @Author Florian Latapie
echo Apache Maven auto install script for Windows & echo. & echo Downloading the zip file & echo.
curl -o tmp.zip https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip
echo Installation & echo.
powershell -command "Expand-Archive tmp.zip 'C:\Program Files\apache'"
setx /M PATH "%PATH%;C:\Program Files\apache\apache-maven-3.8.6\bin"
del tmp.zip
@FlorianLatapie
FlorianLatapie / AreYouDumb.java
Last active December 30, 2022 17:00
I got lost on Instagram and wanted to recreate what I saw.
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Random;
import static javax.swing.SwingConstants.CENTER;
public class AreYouDumb extends JFrame {
private final JLabel label;
@FlorianLatapie
FlorianLatapie / snake.py
Last active December 30, 2022 17:01
Simple python snake using curses, on Windows use the command `pip install windows-curses` to install curses, using PyCharm IDE make sure that you enabled the "Emulate termianl in output console" option to make it work
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
# Constants
KEY_ESC = 27
height = 10
width = 40
half_height = int(height / 2)