I've recently been amazed, if not mind-blown, by how a very simple, "one-line" SAT solver on Interaction Nets can outperform brute-force by orders of magnitude by exploiting "superposed booleans" and optimal evaluation of λ-expressions. In this brief note, I'll provide some background for you to understand how this works, and then I'll present a simple code you can run in your own computer to observe and replicate this effect. Note this is a new observation, so I know little about how this algorithm behaves asymptotically, but I find it quite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon | |
// Based on the work by @zhuowei | |
// @imbushuo - Nov 2020 | |
// To build: | |
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF | |
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON | |
// ^ Per @never_released, tested on 11.0.1, idk why | |
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c | |
// codesign --entitlements simplevm.entitlements --force -s - simplevm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Polyrhythmic Prime Discovery | |
# by Leonard Ritter <[email protected]> | |
primes = [] | |
phases = [] | |
counter = 2 | |
def is_any_phase_zero (): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# coding=utf-8 | |
# Get ids.txt from https://github.com/cjkvi/cjkvi-ids/ and place it next to this script | |
# ~requires python 3.6 or newer on windows~ | |
# note: depends on the accuracy of ids.txt. for some characters, like 祭, it's pretty bad. | |
# see also: http://www.chise.org/ids-find | |
contains = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from data1 import data1 | |
from data2 import data2 | |
from data3 import data3 | |
from data4 import data4 | |
from data500 import data500 | |
from data600 import data600 | |
from data610 import data610 | |
from data700 import data700 | |
all_data = (data1, data2, data3, data4, data500, data600, data610, data700) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// #define CLANG_EXTENSION | |
// Clang compile with -O3 | |
#define VS_EXTENSION | |
// https://godbolt.org/z/sVWrF4 | |
// Clang compile with -O3 -fms-compatibility | |
// VS2017 compile with /O3 |
There is sometimes a situation in which one needs to get the relative offset of a structure field, common examples of this include serialization frameworks which aid to serialize objects, vertex attributes for rendering (D3D, GL.), etc.
The most common technique for getting this information is through the offsetof
macro defined in stddef.h
. Unfortunately using the macro in C++ comes with a
new set of restrictions that prevent some (subjectively valid) uses of it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mini memory editor for Dear ImGui (to embed in your game/tools) | |
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112 | |
// THE MEMORY EDITOR CODE HAS MOVED TO GIT: | |
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor | |
// Click "Revisions" on the Gist to see old version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Poker II Firmware disassembly help tool. | |
original = IO.read("./Poker II original firmware.bin") | |
extracted = "" | |
original.each_byte{|b| | |
m = (((b & 0x0f) << 4) | ((b & 0xf0) >> 4)) ^ 0xff | |
extracted << m.chr | |
} | |
puts extracted |
NewerOlder