Skip to content

Instantly share code, notes, and snippets.

View adrianyorke's full-sized avatar
💭
Currently exploring Data Engineering with Databricks + Spark + Python

Adrian Yorke adrianyorke

💭
Currently exploring Data Engineering with Databricks + Spark + Python
  • Helsinki, Finland
View GitHub Profile
@adrianyorke
adrianyorke / starship_takeoff.py
Last active March 26, 2024 21:00
Simple game - 10 guesses to work out force required for takeoff
import os
import random
# Computer Space Games by Usborne Publishing
# https://drive.google.com/file/d/0Bxv0SsvibDMTNlMwTi1PTlVxc2M/view?resourcekey=0-kaU6eyAmIVhT3_H8RkHfHA
def display_banner(title):
clear_screen_cmd = "clear" if os.name == "posix" else "cls"
os.system(clear_screen_cmd)
print("="*len(title))
@adrianyorke
adrianyorke / LIG_day04_06.py
Created December 6, 2023 23:08
Let it Glow - Day 4 - Binary LED Graph
from machine import Pin
import time
redbutton = Pin(2, Pin.IN, Pin.PULL_DOWN)
greenbutton = Pin(3, Pin.IN, Pin.PULL_DOWN)
seg1 = Pin(13, Pin.OUT)
seg2 = Pin(12, Pin.OUT)
seg3 = Pin(11, Pin.OUT)
seg4 = Pin(10, Pin.OUT)
@adrianyorke
adrianyorke / unicode_tests.py
Last active October 25, 2021 22:50
Unicode character testing for Nordic region
"""Unicode character testing done for Unicode source."""
# Even in the year 2021, unicode is still not used everywhere so we must test our entire processing
# chain for uncommon or exceptional characters.
# Within the Nordic region, we must test for common letters that are used in the various
# languages of the region, which can also be found on our country-specific keyboards.
# Note: It is common for those with Russian heritage to live in Nordic countries, especially Finland.
# Our technology stack and tools must also handle these additional letters not found in the default code page.
NORDIC_SPECIAL_CHARS = [
import xlrd
import subprocess
import os
def get_ram():
"Returns a tuple (total ram, available ram) in megabytes. See www.linuxatemyram.com"
try:
s = subprocess.check_output(["free", "-m"])
lines = s.split("\n")
return (int(lines[1].split()[1]), int(lines[2].split()[3]))