Skip to content

Instantly share code, notes, and snippets.

View vitorio's full-sized avatar

Vitorio Miliano vitorio

View GitHub Profile
@vitorio
vitorio / jsmess.md
Created January 9, 2025 02:19
Still Life with Emulator (Vitorio's Version)

In 2013, I created the cross-compilation infrastructure to thin a large C/C++ codebase and translate vertical slices to JavaScript for presentation on the web.

The project was called JSMESS. It divvied up the monolithic MESS and MAME emulators, each a large C/C++ codebase for emulating hundreds of hardware platforms in a single binary, into just enough code to run individual vintage computers and arcade games, and it was one of the earliest large-scale uses of Emscripten, the LLVM WebAssembly toolchain.

The narrative version of this gist is online here, as an archived Twitter thread:

The project started in October 2011, with the goal of making vintage software as easy to experience on the web as a YouTube video. Paul Ford wrote a nice, lay-accessible introduction for the United Airlines in-flight magazine in May 2013, shortly before I joined and all of this transpired:

@vitorio
vitorio / pinboard-scrape-bmarks.py
Created September 12, 2024 20:44
Scrape the Pinboard UI's "bmarks" JSON into a pickled Python dict (req. python3, requests, bs4)
import requests
import bs4
import pickle
import os
import json
import time
import random
PINBOARD_URL = 'https://pinboard.in'
PINBOARD_USER = 'YOUR_PINBOARD_USERNAME'
@vitorio
vitorio / concordance-repl.py
Created May 12, 2024 07:00
Naive concordance from Twitter archive
# After you've got a list of words from sorting/filter the generated CSV
# copy and paste this into a running Python REPL and keep re-running the
# last line with each word you want to interrogate through the concordance
from nltk.corpus.reader.markdown import MarkdownCorpusReader
from nltk.text import TextCollection
corpus = MarkdownCorpusReader('<YOUR COMBINED MARKDOWN TWEETS FOLDER>', r'.*\.md')
text = TextCollection(corpus)
@vitorio
vitorio / boot.py
Last active March 17, 2024 22:53
Force a kiosk into BIOS to boot from a USB drive + offer ⊞ key after boot, Adafruit Neo Trinkey, CircuitPython 8.x
import board
import touchio
import storage
import usb_cdc
import usb_midi
import usb_hid
# Neo Trinkey
touch1 = touchio.TouchIn(board.TOUCH1)
touch2 = touchio.TouchIn(board.TOUCH2)
@vitorio
vitorio / main.py
Created January 15, 2024 01:18
CO2 monitor using Pimoroni Breakout Garden + 1.12" Mono OLED SPI + SCD41 breakouts, MicroPython 1.21
from pimoroni import BREAKOUT_GARDEN_I2C_PINS
from pimoroni_i2c import PimoroniI2C
import breakout_scd41
from machine import Pin, SPI
import sh1107 # https://github.com/peter-l5/SH1107
import random
MESSAGE = '0000'
co2 = 0
@vitorio
vitorio / font2x5fixedmononum.py
Last active January 15, 2024 01:30
CO2 monitor using Pimoroni Breakout Garden + 5x5 RGB Matrix + SCD41 breakouts, MicroPython 1.21
# Quick script to convert Adafruit GFX font into binary file.
# Author: Tony DiCola
# License: MIT (https://opensource.org/licenses/MIT)
# Taken from glcdfont.c from Adafruit GFX Arduino library.
FONT = bytes((
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
@vitorio
vitorio / main.py
Last active July 21, 2023 02:42
CO2 monitor using Pimoroni Wireless Plasma Kit + Adafruit SCD40, MicroPython 1.20.3
# https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/plasma_stick/co2.py
# https://docs.micropython.org/en/latest/library/rp2.html#rp2.bootsel_button
# https://github.com/pimoroni/phew/blob/v0.0.3/phew/__init__.py
import time
import plasma
from plasma import plasma_stick
from machine import Pin
import breakout_scd41 as scd
from pimoroni_i2c import PimoroniI2C
@vitorio
vitorio / main.py
Last active July 20, 2023 03:19
CO2 monitor using Pimoroni Tufty 2040 + Adafruit SCD-40, MicroPython 1.20.3
# https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/tufty2040/main.py
# https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/tufty2040/pride_badge.py
# https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/breakout_scd41/scd41_demo.py
from picographics import PicoGraphics, DISPLAY_TUFTY_2040, PEN_RGB332
import time, math, random, gc
from pimoroni import Button, BREAKOUT_GARDEN_I2C_PINS
import breakout_scd41
from pimoroni_i2c import PimoroniI2C
@vitorio
vitorio / boot.py
Last active July 20, 2023 03:20
Force a kiosk into BIOS to boot from a USB drive, Adafruit Trinkey QT2040, CircuitPython 8.x
import board
import digitalio
import storage
import usb_cdc
import usb_midi
import usb_hid
# QT2040 Trinkey
button = digitalio.DigitalInOut(board.BUTTON)
button.switch_to_input(digitalio.Pull.UP)
@vitorio
vitorio / main.py
Last active December 1, 2023 02:29
CO2 monitor using Adafruit Trinkey QT2040 + SCD-40 + ST25DV16K, CircuitPython 8.x
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_scd4x
import neopixel
import adafruit_24lc32
## https://github.com/Neradoc/circuitpython-st25dv