Skip to content

Instantly share code, notes, and snippets.

View sroccaserra's full-sized avatar
🐿️

Sébastien Roccaserra sroccaserra

🐿️
View GitHub Profile
@sroccaserra
sroccaserra / 3d.pde
Last active January 6, 2020 20:08
Simple 2D -> 3D projection
var w = 300
var h = 200;
var inc = 10;
void draw() {
background(0,0);
translate(w+30,50);
@sroccaserra
sroccaserra / ReduceImageWeightOrSize.md
Last active November 11, 2020 10:40
Réduire la taille d'une image, tons de gris, monochrome

Commandes

Avec -monochrome

$ convert source.png -monochrome destination.png
$ convert source.png -monochrome -remap pattern:gray50 destination.png
$ convert source.png -monochrome -resize 512x512 -remap pattern:gray50 destination.png
$ convert source.png -monochrome -remap pattern:gray50 -dither FloydSteinberg destination.png
@sroccaserra
sroccaserra / tcr.sh
Last active September 7, 2020 13:10
Test and commit or revert (TCR)
#!/usr/bin/env bash
T() {
npm t
}
C() {
git commit -am green
echo 'Commit :)'
}
@sroccaserra
sroccaserra / story.ni
Created November 5, 2019 21:09
Inform game
"A Strange Journey" by Sébastien Roccaserra
Release along with an interpreter.
The player is carrying a piece of paper. The description of the piece of paper is "A handwritten note: 'Meet me at the Lagoon. Ask for John.'"
Chapter 1 - The Graveyard
The Graveyard Area is a region.
@sroccaserra
sroccaserra / Makefile
Last active October 31, 2019 11:39
"Hello World" program in x64 assembly for macOs
run: hello
./hello
hello: hello.o
ld -macosx_version_min 10.13.0 -lSystem -o hello hello.o
hello.o: hello.asm
nasm -f macho64 hello.asm -o hello.o
@sroccaserra
sroccaserra / Amiga_samples_conversion.md
Last active May 10, 2024 04:09
Documenting the converstion of old Amiga 8 bit samples

Archive:

These are 8 bit samples often used with the first Amiga trackers of the late 80s and early 90s, like Ultimate Soundtracker. In original and updated formats.

Following the info found in [this other archive][other], I tried to accurately convert the original files to modern & self documenting formats (.wav or .aiff), so they can easily be used in modern DAWs or modern trackers, like

@sroccaserra
sroccaserra / header_stats.md
Last active August 16, 2019 21:31
Filter files by header, extract two bytes of its header, and make stats on that

Note: here I use gxargs and ggrep instead of xargs and grep commands because my OS does not come with GNU xargs and GNU grep by default.

$ find . -type f -not -name '*.aiff' -not -name '*.8svx' -print0 | \
    gxargs -r0 ggrep -bZl '^FORM' | \
    gxargs -0n1 xxd -p -s32 -l2 | \
    sort | uniq -c
@sroccaserra
sroccaserra / convert_raw_to_aiff.py
Last active August 29, 2024 12:27
Convert from raw to aiff format
import argparse
"""
Works only for raw 8 bit signed mono data.
This script was writen as an easy way to convert original Amiga ST-XX raw
samples to a more documented format that keeps the original data untouched.
See also:
@sroccaserra
sroccaserra / xor_file.py
Created August 11, 2019 09:37
XOR a binary file with a binary key
#!/usr/bin/env python3
input_file_name = '000.LFL'
output_file_name = '000.LFL.XORed'
key = bytearray(b'\xFF')
def str_xor(data, key):
for i in range(len(data)):
data[i] ^= key[i % len(key)]
return data
@sroccaserra
sroccaserra / convert_8_bit_pcm_to_json.md
Last active December 23, 2021 01:45
Convert 8 bit mono PCM data to json