View race.py
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 os | |
import time | |
import random | |
animals = "🐅🐆🦓🦣🐘🦛🦏🐪🦒🦘🦬🐃🐂🐄🐎🐖🐏🦙🐐🦌🐕🐈🐓🐇🦝" | |
#animals = "🐶🐱🐭🐰🦊🐻🐼🦁🐯🐨🐻🐮" | |
width = os.get_terminal_size().columns - 2 | |
pos = [width] * len(animals) |
View bootstrap.sh
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 bash | |
# | |
# Bootstrap script for setting up a macOS machine | |
# | |
# Requires xcode and tools! | |
xcode-select -p || exit "XCode must be installed! (use the app store)" | |
echo "Starting bootstrapping" |
View panic.py
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 os | |
import datetime | |
with os.popen("nvram -p") as out: | |
ts_line = next((line for line in out.readlines() if line.startswith("panicmedic-timestamps")), None) | |
if ts_line: | |
ts_hex = ts_line.split("\t")[-1] | |
ts_int = int(ts_hex, 16) | |
ts = datetime.datetime.fromtimestamp(ts_int // 1000000) | |
print(f"Last kernel panic: {ts}") |
View wordle.py
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 collections | |
with open("words.txt") as f: | |
# let's read the words from the file, but ignore anything that ends with s | |
# just to remove plurals | |
words = [line.strip() for line in f.read().splitlines() if line[4] != "s"] | |
# how often the different letter occur? | |
occurances = collections.Counter() | |
for word in words: |
View homebrew-top.py
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 locale | |
import requests | |
import tabulate | |
locale.setlocale(locale.LC_ALL, "en_US") | |
# available snapshots: 30, 90, 365 days | |
data_ranges = {"new": 30, "old": 90} |
View tilted-chessboard.py
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 pyxel | |
class Intro: | |
def __init__(self): | |
pyxel.init(160, 120, caption="Greg was here") | |
self.timer = 0 | |
pyxel.run(self.update, self.draw) | |
def update(self): |
View emoji_terrain.py
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 | |
size = (40, 25) | |
field_types = "🏔⛰🌲🌳🌴🏜🌊" | |
def voronoi_map(): | |
no_seeds = 20 | |
seeds = [ | |
{ |
View matrix.py
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 pyxel | |
class Matrix: | |
def __init__(self): | |
pyxel.init(160, 120, caption="there's no spoon") | |
self.loop = 0 | |
self.width = pyxel.width // 4 |
View xmas.py
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 | |
import math | |
import pyxel | |
class Intro: | |
def __init__(self): | |
pyxel.init(160, 120, caption="xmas") | |
self.xm = pyxel.width // 2 |
View scroll.py
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 math | |
import random | |
import pyxel | |
class Intro: | |
def __init__(self): | |
pyxel.init(160, 120, caption="Twin Sectors") | |
self.amplitude = 10 |
NewerOlder