Skip to content

Instantly share code, notes, and snippets.

// Tearing test
#include "32blit.hpp"
uint16_t width = 160;
uint16_t height = 120;
uint32_t prev_buttons = blit::buttons;
void init(void) {
blit::set_screen_mode(blit::lores);
// Update test
#include <unistd.h>
#include "32blit.hpp"
#include "../../../../../../usr/include/zconf.h"
uint16_t width = 160;
uint16_t height = 120;
uint32_t prev_buttons = blit::buttons;
@ali1234
ali1234 / burn.cpp
Last active January 31, 2020 13:38
image retention test. don't run this.
// Tearing test
#include "32blit.hpp"
uint16_t width = 160;
uint16_t height = 120;
uint32_t prev_buttons = blit::buttons;
uint32_t updates = 0;
@ali1234
ali1234 / mpbridge.py
Created February 27, 2021 21:06
32blit multiplayer bridge (doesn't work)
import click
import pyudev
import socket
import serial
import serial.threaded
class Worker(serial.threaded.Protocol):
def __init__(self, socket):
self.socket = socket
@ali1234
ali1234 / SoundMgr.cpp
Created March 10, 2021 12:41
Wave sound playerback manager for 32Blit
// hpp
#pragma once
#include <cstdint>
#include "32blit.hpp"
enum Sound {
BlockSmash,
// [ 56.0, 4*62.0, 48.0, 0.6 ], // WHAM 5.04 outer side large
// [ 56.0, 2*62.0, 48.0, 0.6 ], // WHAM 5.04 outer side small
// [ 56.5, 63.5, 48.0, 0.6 ], // WHAM 5.04 inner
// [ 56.5, 62.5, 48.0, 0.6, [0.125, 0.5, 0.25, 0.125] ], // WHAM 5.04 outer
$fs = 0.1;
module fillet(r) {
@ali1234
ali1234 / infinite.py
Last active November 27, 2021 19:41
Blender Infinite Backups
bl_info = {
"name": "Infinite Backups",
"author": "Alistair Buxton <[email protected]>",
"version": (1, 0),
"blender": (2, 80, 0),
"doc_url": "https://gist.github.com/ali1234/415c5ac863c5649c41a22fe061351a22",
"tracker_url": "https://gist.github.com/ali1234/415c5ac863c5649c41a22fe061351a22",
"category": "System",
}
@ali1234
ali1234 / hypersudoku.py
Created January 8, 2022 00:33
Find orthogonal solutions for hypersudoku
#!/usr/bin/env python3
from collections import defaultdict
from itertools import combinations, permutations
from math import isqrt
from subprocess import check_call
def inner(n):
return range(1, n+1)
Convexity
---------
Explanation for mathematicians:
1. Every object in OpenSCAD must be closed. An object is closed if it partitions space into two regions:
"inside" (the object itself) and "outside" (the rest of the empty space that the object does not occupy).
For the purposes of understanding convextity, we can ignore positions that lie exactly on the object's surface,
and say that any arbitrarily selected position in space must be either inside or outside the object - never both.
@ali1234
ali1234 / talkie.py
Last active July 10, 2022 01:41
talkie.py
# https://github.com/going-digital/Talkie ported to Python
import queue
import random
import numpy as np
class BitReader:
def __init__(self, data):