Skip to content

Instantly share code, notes, and snippets.

View YoRyan's full-sized avatar
🚄
Choo choo!

Ryan Young YoRyan

🚄
Choo choo!
View GitHub Profile
@YoRyan
YoRyan / National Transit Database Data Journalism.fsx
Created September 5, 2024 06:37
Read data from the FTA's National Transit Database into Deedle with F#.
#r "nuget: Deedle"
#r "nuget: ExcelDataReader"
#r "nuget: ExcelDataReader.DataSet"
open Deedle
open ExcelDataReader
type Reporter =
{ NtdId: string;
Mode: string;
@YoRyan
YoRyan / surfboard-scraper.py
Created January 26, 2022 15:27
Scrape connection statistics from a Motorola Surfboard cable modem.
#!/usr/bin/env python3
import typing as typ
from dataclasses import dataclass
from itertools import islice
from time import sleep, time_ns
import bs4 # type: ignore
import requests
@YoRyan
YoRyan / wayback.py
Created January 3, 2022 21:07
Use the Wayback Machine API to search old websites.
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from argparse import ArgumentTypeError, ArgumentParser
from collections import Counter
from datetime import datetime, timezone
from pathlib import Path
from re import search
from archivecdx import Listing as ArchiveListing
@YoRyan
YoRyan / pipe-to-eventsource.py
Last active August 30, 2023 09:51
Serve up a text stream with dynamic updates using Python and EventSource. This took me more time to create than I'm willing to admit and I'm proud.
#!/usr/bin/env python3
import threading
from copy import copy
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from sys import stdin
class ProducerConsumer():
@YoRyan
YoRyan / Extract Civ 6 Music.ps1
Last active April 18, 2023 13:57
Extract the soundtrack from Sid Meier's Civilization VI and its expansions with PowerShell. No piracy - this requires your own copy of the game.
# To run in the PowerShell ISE, first execute:
# > Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted
# on the interactive console.
$OutputPath = "."
# Path to directory containing ww2ogg executable and codebook - https://github.com/hcs64/ww2ogg
$Ww2OggPath = ".\ww2ogg024\"
# Path to revorb executable - https://hydrogenaud.io/index.php/topic,64328.msg574110.html#msg574110
$RevorbExec = ".\revorb.exe"
# Path to Civ 6 ;)
@YoRyan
YoRyan / keepass2pwsafe.py
Created February 25, 2018 02:28
KeePass to PasswordSafe password database converter
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Use me:
# 1. Export to CSV from KeePass
# 2. $ ./keepass2pwsafe.py <keepass.csv >passwordsafe.txt
# 3. Import from Plain Text in PasswordSafe, use the default delimiters
# Tested with KeePassXC 2.2.4 and PasswordSafe 1.02.1 for Linux
@YoRyan
YoRyan / excavator-driver.py
Last active April 2, 2022 20:36
Cross-platform controller for NiceHash Excavator for Nvidia (aka, NiceHash 2 for Linux). This is no longer maintained, please see https://github.com/YoRyan/nuxhash
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Cross-platform controller for NiceHash Excavator for Nvidia."""
# Example usage:
# $ excavator -p 3456 &
# $ python3 excavator-driver.py
# History:
@YoRyan
YoRyan / steamq.py
Last active June 27, 2020 08:45
Steam Discovery Queue crawler in Python. Gets your Steam sale trading cards so you don't have to.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Get your Steam trading cards by browsing through the Discovery Queue."""
# Makes extensive use of steamweb, see https://github.com/jayme-github/steamweb
# Inspired by /u/zetx's userscript, see https://www.reddit.com/r/Steam/comments/3xvie5/userscript_to_automatically_go_through_a/
# install dependencies: pip3 install --user steamweb