Skip to content

Instantly share code, notes, and snippets.

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#from matplotlib.animation import FuncAnimation
import numpy as np
import sys
rng = list(map(float, sys.stdin.readlines()))
period = len(rng)
#print(rng)
@lemon32767
lemon32767 / prng16.c
Last active March 8, 2021 10:09
16-bit seed PRNG. period=65534. uniform-ish looking distribution https://i.imgur.com/kKI5W2s.png
typedef unsigned short u16;
u16 random_u16(void) {
static u16 s;
s ^= s << 8;
s = ((s & 0xFF) << 1) ^ ((s << 8) | (s >> 8));
s = 38607*s + 35335;
s = (s >> 1) ^ (-(~s & 1) & 0x9E74) ^ 0x7E00;
@lemon32767
lemon32767 / rotater.py
Last active July 31, 2021 09:31
gui program to rotate touchscreen for lenovo ideapad flex 5 14ARE05
#!/bin/python
import tkinter as tk
import subprocess as sp
import os
rot = ["normal", "left", "inverted", "right"]
trans = ["1 0 0 0 1 0 0 0 1", "0 -1 1 1 0 0 0 0 1", "-1 0 1 0 -1 1 0 0 1", "0 1 0 -1 0 1 0 0 1"]
devs = ["Wacom HID 5215 Finger touch", "Wacom HID 5215 Pen stylus", "Wacom HID 5215 Pen eraser"]