Skip to content

Instantly share code, notes, and snippets.

View thewhodidthis's full-sized avatar
🔘

Sotiri Bakagiannis thewhodidthis

🔘
View GitHub Profile
@thewhodidthis
thewhodidthis / randint.js
Last active August 8, 2021 16:23
Towards a NumPy inspired bound random integer producer
const assert = require('assert');
// Produce random (signed) integers from min inclusive to max exclusive
function randint(min = 0, max) {
let lo = min;
let hi = max;
if (typeof max === 'undefined') {
hi = lo;
lo = 0;
@thewhodidthis
thewhodidthis / README.md
Last active January 17, 2022 17:44
Draft SSG

Poor man's static site builder

Basic,

\
redcarpet content.md |          # 1. Parse markdown
mustache - data.yaml.mustache | # 2. Save as unescaped HTML in proxy template
mustache - layout.mustache |    # 3. Fill in page layout
tidy # 4. Fix indentation
@thewhodidthis
thewhodidthis / snippet.sh
Created February 15, 2022 04:54
Retouch image files to reflect EXIF dates
find ./*.jpg -exec sh -c 'touch -d $$(date -j -f "%Y:%m:%d %H:%M:%S" "$$(identify -format "%[EXIF:DateTimeOriginal]" {})" +%Y-%m-%dT%H:%M:%S) {}' \;
@thewhodidthis
thewhodidthis / platform.md
Last active March 20, 2022 13:40
Progressives

ΟΙ ΠΡΟΟΔΕΥΤΙΚΟΙ

ΚΑΤΑΣΤΑΤΙΚΟ

ΑΘΗΝΑ 15 ΑΥΓΟΥΣΤΟΥ 2012

  1. ΠΡΟΛΟΓΟΣ
    Κάνοντας χρήση των δικαιωμάτων που κατοχυρώνει το Σύνταγμα, αποφασίσαμε στις 15 Αυγούστου 2012 το σχηματισμό των Προοδευτικών, πολιτικού κόμματος που θα υπηρετεί την ελεύθερη λειτουργία του δημοκρατικού πολιτεύματος σύμφωνα με το άρθρο 29 του νόμου 3023/2002, παρ. 1. Οι Προοδευτικοί πρεσβεύουν τις αρχές του ορθολογισμού, της ανεκτικότητας, της εργασίας, της αλληλεγγύης, της δημιουργικότητας, της ελεύθερης έκφρασης, της ανεξιθρησκείας, του διαλόγου και της συνεννόησης.

  2. ΚΟΜΜΑ

    1. Τίτλος
      Ιδρύεται πολιτικό κόμμα με τίτλο ΟΙ ΠΡΟΟΔΕΥΤΙΚΟΙ (αγγλ. THE PROGRESSIVES).
/*
const run = async () => {
await sleep(1000)
console.log("One")
await sleep(1000)
console.log("Two")
}
run()
*/
@thewhodidthis
thewhodidthis / links
Last active July 16, 2022 19:14
Helps extract Bookmarks.plist data into JSON
@thewhodidthis
thewhodidthis / main.js
Created December 6, 2022 09:32
Common hashing algorithms in JS
export function crc32c(data, n = data.length, poly = 0xEDB88320) {
let crc = 0xFFFFFFFF
for (let i = 0; i < n; i += 1) {
crc = crc ^ data.charCodeAt(i)
for (let j = 0; j < 8; j += 1) {
crc = crc & 1 ? (crc >>> 1) ^ poly : crc >>> 1
}
}
build:
@mkdir $$(date +"%Y%m%d%s"); cd $$_; echo "$$(date +"%Y%m%d%s")" > index.html; zip ../"$$(date +"%Y%m%d%s")".zip -r .
@thewhodidthis
thewhodidthis / Makefile
Last active May 17, 2023 19:11
Extremely random pixel sorted image maker
# The filenaming timestamp
D?=$$(date +"%Y%m%d%s")
# Pix or bitmap dimensions
W?=80
H?=45
# How many numbers total?
S?=$$(bc <<< "3 * $W * $H")
# How many samples?
G?=$$(bc <<< "3 * $H")
# Out image dimensions
@thewhodidthis
thewhodidthis / Makefile
Last active May 28, 2023 20:28
Worley noise maker
# The filenaming timestamp
D?=$$(date +"%Y%m%d%s")
# How many feature points?
R?=10
# Pixmap dimensions
W?=80
H?=45
# How many pixels?
S?=$$(($W * $H - 1))
# Out image dimensions