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
""" | |
ardbo.py | |
inspired by parker higgins "If you take the "c" and "x" off the ends of | |
"cardboard box", you're left with a perfectly repeating ardbo-ardbo" | |
<https://bsky.app/profile/xor.blue/post/3lf3xmy7iac2o> | |
""" | |
import sys | |
import collections |
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
// unfold animation https://twitter.com/cwillmore/status/1355644262835122176 | |
// developed in processing 3.5.4 | |
static final int FRAME_RATE = 30; | |
static final float ITER_DURATION = 2.0; // seconds | |
static final int TOTAL_FRAMES = (int)(FRAME_RATE * ITER_DURATION); | |
static final int WIDTH = 500; | |
static final int HEIGHT = 500; | |
static final boolean SAVE_FRAMES = false; |
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
// ell clock https://twitter.com/cwillmore/status/1353435612636803073 | |
// developed with processing 3.5.4 (processing.org) | |
// TODO: | |
// - motion blur | |
// - ripple update of ells - one only starts rotating when it has room to (<< ... <> ... >>) | |
static final int DEPTH = 3; | |
static final int N = 1 << (DEPTH + 1); | |
static final int FRAME_RATE = 30; | |
static final float DT = 1 / (float)FRAME_RATE; |
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
^([70]*|([18]|[70]*[18])(5?|4[70]*[18])*(4|4[70]*)|([92]|[70]*[92]|([18]|[70]*[1 | |
8])(5?|4[70]*[18])*(6|4[70]*[92]))(3?|[18][70]*[92]|([92]|[18][70]*[18])(5?|4[70 | |
]*[18])*(6|4[70]*[92]))*([18]|[18][70]*|([92]|[18][70]*[18])(5?|4[70]*[18])*(4|4 | |
[70]*))|(3|[70]*3|([18]|[70]*[18])(5?|4[70]*[18])*([70]|4[70]*3)|([92]|[70]*[92] | |
|([18]|[70]*[18])(5?|4[70]*[18])*(6|4[70]*[92]))(3?|[18][70]*[92]|([92]|[18][70] | |
*[18])(5?|4[70]*[18])*(6|4[70]*[92]))*(4|[18][70]*3|([92]|[18][70]*[18])(5?|4[70 | |
]*[18])*([70]|4[70]*3)))([18]?|5[70]*3|(6|5[70]*[18])(5?|4[70]*[18])*([70]|4[70] | |
*3)|([70]|5[70]*[92]|(6|5[70]*[18])(5?|4[70]*[18])*(6|4[70]*[92]))(3?|[18][70]*[ | |
92]|([92]|[18][70]*[18])(5?|4[70]*[18])*(6|4[70]*[92]))*(4|[18][70]*3|([92]|[18] | |
[70]*[18])(5?|4[70]*[18])*([70]|4[70]*3)))*(5|5[70]*|(6|5[70]*[18])(5?|4[70]*[18 |
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
#!/usr/bin/env python3 | |
# https://twitter.com/cwillmore/status/1192927454429511680 | |
neighbors1 = [[0, 1], [0, 1, 2], [1, 2]] | |
def neighbors(i, j): | |
"""Enumerate all the buttons that are adjacent to button (i, j).""" | |
for ii in neighbors1[i]: | |
for jj in neighbors1[j]: | |
if i != ii or j != jj: | |
yield (ii, jj) |
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
# 05/02/18 04:46 PM | |
# program to draw twitter background | |
# might be a good foundation for beesandbombs-style animation? | |
from PIL import Image, ImageDraw | |
import os | |
import aggdraw | |
import random | |
import math |
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
import random | |
import math | |
def random_unit_vector(n): | |
"""Return the components of a random unit vector in 'n' dimensions.""" | |
result = [random.gauss(0, 1) for i in xrange(n)] | |
norm = math.sqrt(sum(x**2 for x in result)) | |
result = [x / norm for x in result] | |
return result |
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
""" | |
parse_number.py | |
Utilities for parsing English numbers into integers. | |
Author: pmdboi @ reddit (see | |
<http://www.reddit.com/r/Python/comments/hv8rp/can_anyone_suggest_a_library_for_converting/>) | |
""" | |
import re |