Skip to content

Instantly share code, notes, and snippets.

@gschizas
gschizas / break_up_images.py
Last active May 8, 2018 16:35
Download spritesheet from subreddit and separate images
import os
import io
import PIL.Image
import requests
import tinycss
from praw_wrapper import praw_wrapper
SUBREDDIT_NAME = input("Enter your subreddit name here: ")
@gschizas
gschizas / clear_emoji.py
Last active May 27, 2021 18:25
Mass upload emoji to reddit redesign alpha
from tqdm import tqdm
from praw_wrapper import praw_wrapper
r = praw_wrapper(scopes=['read', 'structuredstyles'])
subreddit = input("Enter your subreddit name here: ")
sr = r.subreddit(subreddit)
all_emojis = r.get(f"/api/v1/{subreddit}/emojis/all")
@gschizas
gschizas / build_install_nano.sh
Last active November 28, 2018 15:27
Build and install latest version of nano text editor
#!/usr/bin/env sh
set -o errexit
set -o nounset
ver=$(git ls-remote --tags https://git.savannah.gnu.org/git/nano.git/ | grep '[0-9]$' | tail -1 | cut -d '/' -f 3)
ver2=$(echo $ver|cut -c2-)
ver3=$(echo $ver|cut -c2-2)
curl -O https://www.nano-editor.org/dist/v$ver3/nano-$ver2.tar.gz
@gschizas
gschizas / mapper.lua
Last active August 24, 2020 13:36
Map The Prize for Amstrad CPC 6128 using BizHawk and directly converting screen memory to a large image
map_x = 1
map_y = 1
map_lvl = 1
handled_press = {}
function handle_keypress(keys, keyname, fn)
if (keys[keyname] ~= nil and (handled_press[keyname] == 0 or handled_press[keyname] == nil)) then
-- print(tostring(emu.framecount()) .. ": Key pressed")
fn()
handled_press[keyname] = 1
@gschizas
gschizas / README.md
Created March 12, 2021 01:01
Convert Amstrad CPC Video Memory to an PIL Image

Some assumptions:

  • The file being read has video memory stored in the first 0x4000 (16384) bytes.
  • The screen hasn't been scrolled
  • Screen mode and border and palette inks follow the main data:
    • MODE is a single byte in position 0x4000
    • BORDER (unused) is in position 0x4001
  • INKS 0-15 follow in positions 0x4002-0x4011