Skip to content

Instantly share code, notes, and snippets.

View AnthonyBriggs's full-sized avatar

Anthony Briggs AnthonyBriggs

  • Melbourne, Australia
View GitHub Profile
@AnthonyBriggs
AnthonyBriggs / lavarand.py
Last active January 13, 2024 12:45
Python alpha implementation of lavarand, the lava lamp-seeded random number generator.
#!/usr/bin/python
import hashlib
"""
Python implementation of the lavarand n-way, sha-1, xor-rotate-and-fold
algorithm, aka. The Digital Blender (tm).
For details, see https://web.archive.org/web/20121015231322/http://www.lavarand.org/what/digital-blender.html

Keybase proof

I hereby claim:

  • I am AnthonyBriggs on github.
  • I am anthonybriggs (https://keybase.io/anthonybriggs) on keybase.
  • I have a public key whose fingerprint is BFCD 1D56 F8B3 9AF8 F345 5407 CCD7 9551 5316 B736

To claim this, I am signing this object:

@AnthonyBriggs
AnthonyBriggs / clicka.sh
Created October 31, 2014 11:03
Useful xmacro script for *clicker games
#!/bin/bash
# sudo apt-get install xmacro
# Run this in a window alongside your browser,
# then you have 2 seconds to quickly mouse over
sleep 2;
for (( ;; ))
do
@AnthonyBriggs
AnthonyBriggs / pycodestyle_errors.py
Last active July 10, 2017 13:26
Rough code to scrape pycodestyle for errors and output .rst-ish
"""Rough script to scrape pycodestyle.py and intro.rst for error codes and descriptions, then generate something .rst-ish"""
import collections
import re
import pycodestyle
ErrorCode = collections.namedtuple("ErrorCode", field_names=("code", "short_msg", "long_msg"))
"""Script to mass-convert all the Python 2 files in a directory to Python 3."""
import os
import sys
try:
target = sys.argv[1]
if target.endswith('"'):
target = target[:-1]
@AnthonyBriggs
AnthonyBriggs / my_turtle.py
Created January 30, 2018 02:49
A fractal turtle L-system thing
"""Fancy turtle L-system thing
Messing around at lunchtime :)
Inspired by https://bitaesthetics.com/posts/fractal-generation-with-l-systems.html"""
# Maybe this runs under Python 2? Who knows? Not sure what the turtle
# changes between 2 and 3 are
from __future__ import print_function
@AnthonyBriggs
AnthonyBriggs / shakespeare.py
Created June 7, 2018 05:23
Write an Shakespeare!
"""Write an Shakespeare!"""
### What are these words call'd that stands hard by?
try:
words = open('shakespeare.txt').read().split()
print(len(words), "total words in shakespeare.txt")
except FileNotFoundError:
print("No, hath not? Rosalind lacks, then, the shakespeare.txt")
@AnthonyBriggs
AnthonyBriggs / mu_joystick_test.py
Created August 28, 2018 23:55
Sample script to get joystick input from my version of pgzero
# Write your code here :-)
# Pygame -> pgzero joystick hackery :)
import pygame
import pgzero
pygame.joystick.init()
joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
inited = [j.init() for j in joysticks]
print(joysticks)
@AnthonyBriggs
AnthonyBriggs / joystick_demo.py
Created September 10, 2018 13:32
Mu/PygameZero/Kenney.nl demo code
"""
Demo code for Mu/PygameZero using kenney.nl graphics.
There's a short video demo at https://www.youtube.com/watch?v=b2IPNCJtUL4.
NOTE: this relies on two patches to Mu which aren't yet in
the main PgZero repository, one which adds joystick
support, and another which adds a flip property to
the Actor class.
"""