Skip to content

Instantly share code, notes, and snippets.

@andrejbauer
andrejbauer / wlem.agda
Last active June 19, 2023 04:40
A formal proof that weak excluded middle holds from the familiar facts about real numbers.
{-
Weak excluded middle states that for every propostiion P, either ¬¬P or ¬P holds.
We give a proof of weak excluded middle, relying just on basic facts about real numbers,
which we carefully state, in order to make the dependence on them transparent.
Some people might doubt the formalization. To convince yourself that there is no cheating, you should:
* Carefully read the facts listed in the RealFacts below to see that these are all
just familiar facts about the real numbers.
-- 1. Prove X⁷≡X in the polynomial quotient semiring ℕ[X]/(X≡X²+1)
-- 2. Define a map toType : ℕ[X]/(X≡X²+1) → Type,
-- using the semiring structure of Type and the fact that
-- the equation T≡T²+1 holds for the type of binary trees T.
-- 3. We deduce T⁷ ≡ T, by T⁷ ≡ toType X⁷ ≡ toType X ≡ T
-- 4. ???
-- 5. Profit
{-# OPTIONS --cubical #-}
module S where
@vmxdev
vmxdev / hello.asm
Last active June 23, 2022 15:49
8086 16-bit helloworld.com
; nasm hello.asm -fbin -o hello.com
; to run in DosBox: dosbox hello.com
org 100h
section .text
start:
mov ax, 13h
int 10h

*excerpt from slab6.txt in the SLAB6 download found at http://advsys.net/ken/download.htm#slab6 *

VOX file format

Both SLABSPRI&SLAB6(D) support a simpler, uncompressed voxel format using the VOX file extension. Here's some C pseudocode that describes the format:

long xsiz, ysiz, zsiz;          //Variable declarations
char voxel[xsiz][ysiz][zsiz];
@vmxdev
vmxdev / fact.c
Last active February 3, 2021 05:48
Calculate factorials using gmp
/*
* $ cc -O3 -Wall -pedantic -Wextra fact.c -lgmp
*/
#include <stdio.h>
#include <gmp.h>
static void
factorial(long n, mpz_t r)
{
@vmxdev
vmxdev / fizzbuzz.s
Last active October 14, 2020 10:24
fizzbuzz in GNU assembly
/*
* To compile and link:
*
* $ gcc -Wall -pedantic -Wextra fizzbuzz.s -no-pie -o fizzbuzz
*/
.data
/* Strings to print */
fizz: .asciz "fizz\n"
@dim13
dim13 / try.c
Created August 9, 2019 12:28
try/catch in plain c
#include <err.h>
#include <stdio.h>
#include <setjmp.h>
#include <signal.h>
static sigjmp_buf exception;
#define try if (!sigsetjmp(exception, 1))
#define catch else
#define throw siglongjmp(exception, 1)
@kumbasar
kumbasar / imagetest.sh
Created April 25, 2019 19:29
How To Create a NTFS Image File in Linux
#!/bin/bash
set -x
image="test.img"
label="test"
mntdir=`mktemp -d`
sudo dd status=progress if=/dev/zero of=$image bs=6M count=1000 && sync
echo 'type=7' | sudo sfdisk $image
@seanjensengrey
seanjensengrey / octal_x86.txt
Last active July 9, 2025 04:26
x86 is an octal machine
# source:http://geocities.com/SiliconValley/heights/7052/opcode.txt
From: [email protected] (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@nickbudi
nickbudi / README.md
Last active November 4, 2023 10:53
Cygwin git compatibility with VS Code (or other Windows programs) using cygpath

Cygwin Git + VS Code compatibility

Thanks and credit to mattn and ferreus on GitHub.

Also check out Developing on WSL and/or wslpath (Windows 10 Build 17046 or later) if you're using the Windows Subsystem for Linux.