Skip to content

Instantly share code, notes, and snippets.

@negative-seven
negative-seven / tetris_indirect_jump_times.lua
Last active January 21, 2024 00:20
NES Tetris cycle time calculator for reaching corruptable indirect jumps
View tetris_indirect_jump_times.lua
--[[
script for the NES game Tetris with support for the NTSC, PAL, and three game cartridge versions, compatible with BizHawk 2.9.1, Mesen 0.9.9, and Mesen 2
on frames where the score addition routine gets run, calculates after how many cycles the "switch_s_plus_2a" subroutine is reached each time
intended to help analyze program counter corruption (game crash/ACE)
the script displays a table on screen showing the number of cycles between reaching the NMI handler and reaching "switch_s_plus_2a", on frames where score is calculated
columns "sw0" to "sw7" refer to the 8 times "switch_s_plus_2a" is reached
the "real" column shows the real cycle times, as measured with breakpoints
the "pred" column shows predicted cycle times, calculated at the start of the NMI based on the console state; the function calculating these contains comments detailing cycle times for particular parts of code
the "simp" column shows simplified cycle times, also calculated at the start of the NMI; the result should be the same as in t
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active February 28, 2024 21:34
How to compress PDF with ghostscript
View compress_pdf.md

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9