Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / AddApplicationToControlledFolder.ps1
Last active March 6, 2022 06:53
Allow all blocked apps to Windows Defender's Controlled folder access (interactively)
$appEvents = Get-WinEvent -LogName "Microsoft-Windows-Windows Defender/Operational" |
Where-Object {$_.Id -eq "1123"}
$allBlockedProcesses = (
$appEvents |
ForEach-Object {
(([xml]$_.ToXml()).Event.EventData.Data |
Where-Object {
$_.Name -eq "Process Name"
}).'#text'
} |
@gschizas
gschizas / build_install_tig.sh
Last active March 27, 2018 11:23
Build and install tig from sources
#!/usr/bin/env sh
ver=$(curl https://api.github.com/repos/jonas/tig/releases/latest | jq --raw-output '.tag_name[4:]')
sudo apt install -y libncurses5-dev
wget -c https://github.com/jonas/tig/releases/download/tig-$ver/tig-$ver.tar.gz
tar -xzvf tig-$ver.tar.gz
cd tig-$ver/
make prefix=/usr/local/
sudo make install install-doc prefix=/usr/local/
@gschizas
gschizas / build_install_git.sh
Last active March 31, 2018 08:12
Build and install git from sources
#!/usr/bin/env sh
ver=$(curl https://api.github.com/repos/git/git/tags | jq -r 'first(.[].name | select(test("v\\d\\.\\d+\\.\\d+$")))[1:]')
sudo apt install -y \
dh-autoreconf libcurl4-gnutls-dev libexpat1-dev \
gettext zlib1g-dev libssl1.0-dev \
asciidoc xmlto docbook2x
# getopt
@gschizas
gschizas / build_install_python.sh
Last active April 22, 2018 08:10
Install Python from Source
#!/usr/bin/env sh
set -o errexit
set -o nounset
ver=$(curl https://api.github.com/repos/python/cpython/tags | jq -r 'first(.[].name | select(test("v\\d\\.\\d+\\.\\d+$")))[1:]')
ver2=$(echo $ver|cut -c1-3)
sudo apt install -y build-essential git jq libbz2-dev libc6-dev libffi-dev libgdbm-dev liblzma-dev libncurses5 libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev openssl tk-dev zlib1g-dev
@gschizas
gschizas / Amstrad-CPC-464__6128_.kbd.json
Last active November 2, 2020 18:22
Amstrad CPC 464+/6128+
[
{
"name": "Amstrad CPC 464+/6128+",
"background": {
"name": "ABS WA",
"style": "background-image: url('/bg/plastic/abs-wa.jpg');"
}
},
[
{