This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
const fs = require('fs'); | |
const lines = fs.readFileSync(process.argv[2], 'utf8').split(/(?<=[^\\])\n/); | |
lines.sort((a, b) => a.split(/:/)[1] - b.split(/:/)[1]); | |
fs.writeFileSync(process.argv[2], lines.join('\n'), 'utf8'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let elem = Array.prototype.slice.call(document.getElementsByClassName('btn-download')).map(e=>e.href).filter(u=>u.endsWith('/csv')); | |
let numbers = elem.map(u=>/invoice[/]([^/]+)/.exec(u)[1]); | |
let filename = 'invoice-' + numbers[0] + '-' + numbers[numbers.length - 1] + '.csv'; | |
let csv = ''; | |
for (let url of elem) | |
csv += await (await fetch(url)).text(); | |
let a = document.createElement("a"); | |
a.download = filename; | |
a.href = a.href = "data:text/csv,"+encodeURIComponent(csv); | |
a.click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import util from 'node:util'; | |
import * as fs from 'node:fs/promises'; | |
import * as crypto from 'node:crypto'; | |
import Minizip from 'minizip-asm.js'; | |
const | |
reFile = /^P-[0-9A-F]{4}([/]0[.]xml|[.]zip)$/, | |
pbkdf2 = util.promisify(crypto.pbkdf2); | |
export async function decodeProject(proj, password) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export LANG=C | |
cat Satispay-*.csv | \ | |
gawk -F ' *, *' ' | |
NR>1 { | |
match(substr($5, 2), "^([0-9]{1,2}) ([a-z]{3}) ([0-9]{4})$", a) | |
switch (a[2]) { | |
case /gen|jan/: a[2] = "01"; break; | |
case "feb": a[2] = "02"; break; | |
case "mar": a[2] = "03"; break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
awk -F"\t" -vq="'" '{ | |
t=system("tmux new-window -n " q $1 q) | |
system("tmux send-keys -t " q t q " " q $2 q " C-m") | |
}' <<EOF # commands can contain ", but avoid ' and tabs | |
tab1 echo command on tab 1 | |
tab2 echo command on tab 2 | |
tab3 echo tab 3 ; echo "tab 3 cmd 2" | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://md5le.vercel.app/ | |
const | |
url = 'https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt', | |
fs = require('fs').promises, | |
hash = require('crypto').createHash('md5'), | |
rl = require('readline/promises').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<title>Generate PDF</title> | |
<script src="https://github.com/devongovett/pdfkit/releases/download/v0.6.2/pdfkit.js"></script> | |
<script src="https://github.com/devongovett/blob-stream/releases/download/v0.1.2/blob-stream-v0.1.2.js"></script> | |
<style> | |
html, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 FQDN" | |
exit 1 | |
fi | |
cd `dirname "$0"` | |
if [ ! -f ca.crt ]; then | |
openssl ecparam -genkey -name prime256v1 -out ca.key | |
openssl req -x509 -new -SHA256 -nodes -days 3652 -subj "/CN=Root CA/OU=zrepl/O=YourName/C=IT" -key ca.key -out ca.crt | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generates flashcards to study multiplications and division of numbers up to 100 | |
// can be imported into Anki via the File→Import option, use "Basic" type cards | |
let x = {}; | |
for (let a = 2; a <= 100; ++a) | |
x[a] = []; | |
for (let a = 2; a < 100; ++a) | |
for (let b = a; b < 100; ++b) { | |
let m = a * b; | |
if (m > 100) | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script informed by the collectd monitoring script for smartmontools (using smartctl) | |
# by Samuel B. <samuel_._behan_(at)_dob_._sk> (c) 2012 | |
# source at: http://devel.dob.sk/collectd-scripts/ | |
# TODO: This probably needs to be a little more complex. The raw numbers can have more | |
# data in them than you'd think. | |
# http://arstechnica.com/civis/viewtopic.php?p=22062211 | |
# can be add to /etc/crontab like this, and node_exporter will see it automatically: |
NewerOlder