Skip to content

Instantly share code, notes, and snippets.

@negative-seven
negative-seven / tetris_indirect_jump_times.lua
Created October 24, 2022 21:46
NES Tetris cycle time calculator for reaching corruptable indirect jumps
View tetris_indirect_jump_times.lua
--[[
script for the NTSC NES game Tetris, for BizHawk 2.8 and Mesen 0.9.9
FCEUX is unsupported due to emulation inaccuracy and a lacking Lua API
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
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active May 4, 2023 14:10
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