Skip to content

Instantly share code, notes, and snippets.

@naclsn
naclsn / commit-msg
Created January 6, 2023 15:57
Add branch name to commit message.
#!/bin/sh
# prepend branch name to message
# aborts on empty message
# not applied for branch `main`
# by-passe by prefixing with '!!'
# (in which these are removed)
two=`head -c 2 "$1"`
case ${two:-#} in
\#*) : >"$1"; exit 1;;
\!!) sed -i 1s/^..// "$1"; exit 0;;
@naclsn
naclsn / pico8_versions.csv
Last active April 7, 2024 11:37
A simple CSV record of some information gathered from PICO-8 releases.
pico-8 version header version binary mtime archive size binary size
0.0.1 version 3 2015-01-20T19:48:56+01:00 1741 4507
0.0.4 version 4 2015-04-04T23:25:41+02:00 2142 6322
0.0.5 version 4 2015-04-12T00:49:38+02:00 2146 6330
0.1.0 version 4 2015-04-17T23:53:08+02:00 2152 6334
0.1.1 version 4 2015-06-12T01:12:20+02:00 2253 6703
0.1.2 version 5 2015-10-02T21:45:30+02:00 2635 6752
0.1.3 version 5 2015-10-15T23:10:12+02:00 2580 6752
0.1.4 version 5 2016-01-02T23:26:06+01:00 2521 6445
0.1.4b version 5 2016-01-03T23:48:47+01:00 2521 6445
@naclsn
naclsn / pico8_ast_json.ps1
Last active December 30, 2021 12:50
Parses PICO-8's peculiar Lua into an AST, stores the result as a JSON file. See https://github.com/boolangery/py-lua-parser as for the AST itself.
#!/usr/bin/env pwsh
# .SYNOPSIS
# Parses a .p8 file into an AST, stores the result as JSON.
param ([Parameter(Mandatory)][string]$InputP8, [Parameter(Mandatory)][string]$OutputJSON)
$FileInfo = Get-Item $InputP8
$OLDPWD = $PWD
Set-Location $FileInfo.Directory
$TempFile = "_tmp$(Get-Random).txt"
"pico-8 cartridge`n`n__lua__`nprinth([=[`n#include $($FileInfo.Name)`n]=],'$TempFile',true)" > $TempFile
pico8 -root_path "$PWD" -x $TempFile > $null
@naclsn
naclsn / custom-wikipedia.css
Last active April 30, 2022 15:20
Quick and dirty custom CSS / user style for Wikipedia's "Vector" skin (tested on en.wikipedia.org and fr.wikipedia.org).
.mw-page-container {
background-color: #1e1e1e;
border-left: 1px solid #111;
border-right: 1px solid #111;
}
#mw-panel {
border-right: 1px solid #333;
}
@naclsn
naclsn / !please
Last active October 9, 2021 13:03
Python script to write helper function callable from command line, somewhat plateforme independent (even Python2).
#!/usr/bin/env python
# coding: utf-8
def default():
_print("for a list of command use `python please _help`")
_print("for help about a command use `python please _help,command`")
def do_example1():
""" This is an example.