Skip to content

Instantly share code, notes, and snippets.

Alba Mendez jmendeth

Block or report user

Report or block jmendeth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jmendeth
jmendeth / description.md
Last active May 24, 2018
File description of the .fpk format used by Sid Meier's Pirates! (and Civilization IV?)
View description.md

.FPK files

.fpk files can be found in the installation location of «Sid Meier's Pirates!» and contain most assets of the game.

Conceptually, an .fpk is just a zip of files. It's probably just a format they quickly invented to prevent people from messing with their assets. It's pretty simple, but the filenames are 'obfuscated' by adding 1 to each letter.

Apparently, Firaxis (game devs) released a «Civ4 PakBuilder» tool to pack/unpack .fpk files: https://forums.civfanatics.com/threads/civ4-pakbuild.136023/

Script

@jmendeth
jmendeth / enmiendas-pdl-nombre.md
Last active May 29, 2018
Summary about spanish bill 122/000072 ammendments
View enmiendas-pdl-nombre.md

Enmiendas PdL cambio de nombre (122/000072)

EAJ-PNV

Afectan al artículo 8, que permite bajo ciertas condiciones que los extranjeros que no hayan podido hacer el cambio de nombre en su país lo hagan aquí:

  • #1 [tecnicidad] El artículo 8 pasa a ser una disposición en sí misma (neutra)
  • #2 [tecnicidad] Retoque de redacción en el artículo 8 (algo buena)

Cs

@jmendeth
jmendeth / brainfuck.ws
Created Jan 25, 2018
A Brainfuck interpreter, written in Whitespace 🙃
View brainfuck.ws
*
*
This is a Brainfuck interpreter written in the Whitespace programming language.
Any visible characters are comments, just there for easier understanding of the code.
Usage:
Run this program and supply the Brainfuck code *in one line* (for now).
The brainfuck code will run and a final status message will be displayed with the VM state:
- Status code (reason for ending, see section below)
- Offset (byte number of the last loaded instruction, -1 -> none)
@jmendeth
jmendeth / whitespace.py
Last active Jan 14, 2018
Look I made a Whitespace interpreter 😊
View whitespace.py
#!/usr/bin/env python3
# Usage: ./whitespace.py <file>
# Interpreter for the whitespace language.
# https://en.wikipedia.org/wiki/Whitespace_(programming_language)
#
# Implementation details:
# - Code needn't have any particular encoding.
# - I/O character functions deal with bytes, not Unicode codepoints or anything.
# in particular, outputting a number outside [0..255] will result in mod(x, 256) being written.
# - I/O number input expects a 10-base integer followed by a linefeed: /^(-|+)?\d+\n$/
@jmendeth
jmendeth / ownership-recover.py
Created Aug 10, 2017
Script generating "chown" commands to replicate file ownership
View ownership-recover.py
#!/usr/bin/env python
# Script for those hard times when someone "chown"s the
# WHOLE F***ING root and you need a quick solution.
# Run this script on a "sane" computer:
#
# python ownership-recover.py / > commands
#
# And it'll output a list of chown commands to sort of "clone"
# the ownership settings on the machine they're run on, which
# will (hopefully) fix the problems for the time being. (Do a
@jmendeth
jmendeth / README.md
Last active Apr 27, 2017
Utilitites for interacting with TDS 1002 scopes (and possibly others) via RS-232
View README.md

This is a set of utilities that interact with old Tektronix oscilloscopes (only tested on TDS 1002 but will probably work on others) that have the optional RS-232 communications module installed and connected to the serial port.

Possibly my first code ever where I'm preserving (and targeting) Windows compatibility.

  • collect_prints.py waits for prints to be received over the serial port (when the user presses the PRINT button), and writes them to .bmp files. It also copies them to the clipboard on Windows.
@jmendeth
jmendeth / echo-server.js
Created Apr 26, 2017
Server that pipes all its connections with stdio. Pretty simple but can't find anything that does this.
View echo-server.js
#!/usr/bin/env node
const server = require("net").createServer()
server.on("connection", (socket) => {
socket.pipe(process.stdout, { end: false })
process.stdin.pipe(socket)
})
server.listen(process.env.PORT || 8000)
@jmendeth
jmendeth / backup-apt.py
Last active Dec 1, 2016
Tools to assist in migrating installed software (APT)
View backup-apt.py
#!/usr/bin/env python
# Scans APT and produces four lists:
#
# LIST 1: Installed packages not required as direct dependency of any installed package.
# (i.e. could be uninstalled without having to uninstall anything else due to broken dependencies)
#
# LIST 2: Packages marked as intentionally installed.
#
# LIST 3: Intersection of LIST 1 with LIST 2.
#
@jmendeth
jmendeth / timer.js
Created Nov 6, 2016
Class that emits an event after timeout. Can be rescheduled and all...
View timer.js
var util = require("util");
var EventEmitter = require("events");
function Timer(timeout) {
this.timeout = timeout;
}
util.inherits(Timer, EventEmitter);
// Core
@jmendeth
jmendeth / README.md
Last active Nov 16, 2017
Render LaTeX inline code to a small image
View README.md

Quick boilerplate for when you need a LaTeX inline thing converted to an image. Enter the expression in fig.tex, and run:

pdflatex fig.tex < /dev/null && convert -density 600 fig.pdf -flatten -scale 50% -quality 90 fig.jpg

Things you may want to change:

  • To render block content (i.e. an equation) instead of a float or inline content, add varwidth=40em to the document options, or use \minipage for a fixed width.
  • Tweak the -density, -quality and border accordingly, or produce a .png.
You can’t perform that action at this time.