Skip to content

Instantly share code, notes, and snippets.

View EndingCredits's full-sized avatar

William Woof EndingCredits

View GitHub Profile
@EndingCredits
EndingCredits / JSON.bnf
Last active March 24, 2025 22:31
Describing the JSON specification in psuedo-Backus-Naur Form
<json> ::= <primitive> | <container>
<primitive> ::= <number> | <string> | <boolean>
; Where:
; <number> is a valid real number expressed in one of a number of given formats
; <string> is a string of valid characters enclosed in quotes
; <boolean> is one of the literal strings 'true', 'false', or 'null' (unquoted)
<container> ::= <object> | <array>
<array> ::= '[' [ <json> *(', ' <json>) ] ']' ; A sequence of JSON values separated by commas
# Import a library of functions called 'pygame'
import pygame
import numpy as np
# Width and height of display
WIDTH = 255>>0
HEIGHT = 65>>0
# Downscale to ripple grid
SHFT = 2
@EndingCredits
EndingCredits / ripple_qmk.c
Last active July 22, 2019 19:20
Ripple effect for HS60 keyboard > https://i.imgur.com/GBUDbji.mp4
# See below for algorithm details
# https://web.archive.org/web/20160418004149/http://freespace.virgin.net/hugo.elias/graphics/x_water.htm
// GRID_MAX refers to the maximum position of an LED via map_led_to_point
#define LED_GRID_MAX_Y 65
#define LED_GRID_MAX_X 255
// Number to shift right by to get to ripple grid
#define GRID_COARSE 4
def match(path, expr):
names = expr.split('.')[1:]
curr_name = 0
curr_path = 0
wildpath = False
while curr_path < len(path):
el = path[curr_path]
@EndingCredits
EndingCredits / sed.py
Last active February 26, 2020 15:43
blackbody curve fitting, probably broken
import numpy as np
import matplotlib
import scipy
from scipy.optimize import curve_fit
#matplotlib,pgetu,emcee,astropy,warnings
#from scipy import ndimage,optimize; from scipy.optimize import fmin
import matplotlib.pyplot as plt
import sys
import datetime
import matplotlib.dates as mdates