Skip to content

Instantly share code, notes, and snippets.

View TheLukeGuy's full-sized avatar

Luke Chambers TheLukeGuy

  • Massachusetts, USA
  • 17:18 (UTC -04:00)
View GitHub Profile
@TheLukeGuy
TheLukeGuy / materials.py
Last active February 7, 2023 03:08
A script to determine which Minecraft materials have item or block textures.
import json
from pathlib import Path
import requests
VERSION = '1.19.3'
URL = f'https://mcassets.matdoes.dev/versions/{VERSION}/downloads/client/assets/minecraft/textures/%s/%s.png'
TRY = ['item', 'block']
RESULT_FILE = 'results.json'
@TheLukeGuy
TheLukeGuy / split_flags.py
Last active November 14, 2021 21:26
A script to split a Duolingo flag sheet up into individual PNG images.
from io import BytesIO
from pathlib import Path
from cairosvg import svg2png
from PIL import Image, ImageChops
# This likely only works with the old style of flags (flag-spriteXX.svg)
FLAG_SHEET = 'flags.svg'
OUTPUT_DIR = 'flags'
TARGET_FLAG_SIZE = 512
@TheLukeGuy
TheLukeGuy / upscale.cpp
Created September 11, 2020 17:43
Simple (probably inefficient) image upscaling algorithm in C++ which enlarges the individual pixels.
std::byte scaled[scaledWidth * scaledHeight * 4];
int pixelSize = scaledWidth / width;
for (int realRow = 0; realRow < height; ++realRow) {
for (int realColumn = 0; realColumn < width; ++realColumn) {
int realIndex = (realRow * width) + realColumn;
std::byte *realRed = &image[realIndex * 5];
for (int pixelRow = 0; pixelRow < pixelSize; ++pixelRow) {
for (int pixelColumn = 0; pixelColumn < pixelSize; ++pixelColumn) {
@TheLukeGuy
TheLukeGuy / NWS Old Icons.user.js
Last active January 16, 2023 19:46
Changes the icons on National Weather Service's forecast pages to the old set of icons.
// ==UserScript==
// @name NWS Old Icons
// @namespace http://lpx.sh/
// @version 0.6.2
// @description Changes the icons on National Weather Service's forecast pages to the old set of icons.
// @author Luke
// @match *://forecast.weather.gov/MapClick.php*
// @grant none
// ==/UserScript==
@TheLukeGuy
TheLukeGuy / full-speed.py
Last active August 26, 2020 20:02
SSH brute force time test based on thread count.
#!/usr/bin/env python3
# Start config
ATTEMPT_SECONDS = 1.694
COMBINATIONS = 56800235584
# End config
threads = float(input("Threads: "))
tests_per_second = threads / ATTEMPT_SECONDS