Skip to content

Instantly share code, notes, and snippets.

remino /
Created May 26, 2022
POSIX-compliant shell script template
# unnamedscript
unnamedscript_main() {
which realpath 2>&1 > /dev/null \
|| _fatal $e_no_realpath "realpath missing."
remino /
Created May 26, 2022
Shell script: Get last item in array
for last; do true; done
echo $last
remino / basic.example.html
Created May 24, 2022
Minimal valid HTML5 document
View basic.example.html
<!doctype html>
<title>Valid HTML5 Document</title>
This is a valid HTML5 document.
remino / node-es-filename-dirname.js
Created Oct 25, 2021
Get __filename & __dirname in Node native ES modules
View node-es-filename-dirname.js
// Get __filename & __dirname in Node native ES modules
import { URL } from 'url'
const __filename = new URL('', import.meta.url).pathname
const __dirname = new URL('.', import.meta.url).pathname
# Enregistre l’émission Et cetera sur les ondes de Oui FM CKRH
# chaque vendredi soir à 20:00, heure d’Halifax.
# Executer regulièrement via cron :
# 59 7 * * 6 > /dev/null
set -e
remino / parse-jp-address.js
Created Nov 10, 2020
Parse Japanese address into an object
View parse-jp-address.js
// Use at your own risk. Will not work for all Japanese addresses.
const regex = /^(.+[都道府県])?(.+?[市郡区町村]+)([^0-90-9ー- -]*)([0-90-9]+[丁目番地のー--]*(?:[0-90-9]+[番ー--]?(?:[0-90-9]+号?)?)?)?[\s ー-~-]*(.*)?/
const getMatch = (matches, index) => (matches ? matches[index] : null) || ''
const parseJpAddress = (str) => {
if (!str || !str.length) return {}
const matches = `${str}`.trim().match(regex)
remino / script.js
Last active Mar 24, 2020
New Node script using babel-node
View script.js
#!/usr/bin/env npx babel-node --
// vim: ft=javascript
const readline = require('readline');
const minimist = require('minimist');
const { basename } = require('path');
const errors = {
general: 1,
missingArg: 16,
remino /
Last active May 18, 2021
Nintendo Switch: Copy files from old microSD card to new microSD card

Nintendo Switch: Copy files from old microSD card to new microSD card

I'm frustrated every time I upgrade my microSD card in my Nintendo Switch, because no matter what I did before writing the switchcp.bat batch file, nothing seemed to work. Everything I'd do would eventually make a microSD card unreadable by my Switch.

After toying around with this problem for hours, below are some conclusions I've drawn. I can't take responsability for any data loss or damage to your systems. However, I do hope they can help you:

  • Don't copy your files using macOS or Linux. This is a big one. The ExFAT file system used by microSD cards of large capacity (microSDHC or microSDXC) is a proprietary file system by Microsoft. No matter how much licencing was negotiated between OS makers or how much backward engineering was done, only Windows seems to get reading and writing files on ExFAT file systems right. As a Mac user, I was determined to use macOS to do the job, until I tried with a Windows VM and saw all my prob
remino / jsbookmarklet
Created Apr 19, 2018
jsbookmarklet – Minify JavaScript file as browser bookmarklet
View jsbookmarklet
# jsbookmarklet
# 2018-04-19
# Minify JavaScript file using uglify then save it to a file,
# output it to the screen, or copy the output to clipboard (macOS only),
# for usage as a browser bookmarklet.