Skip to content

Instantly share code, notes, and snippets.

View mojoaxel's full-sized avatar
🏠
Working from home

Alexander Wunschik mojoaxel

🏠
Working from home
View GitHub Profile
@rmela
rmela / SQL query results as nodejs read stream
Last active March 24, 2025 13:12
SQLite query results as nodejs readable stream
/*
*
* Return SQLite3 query results as a Nodejs stream, sensitive to backpressure.
*
* Assumes a foo.db file with a lot of rows - I used 1000 with a number & a string
*/
const stream = require('stream');
const sqlite = require('sqlite3');
class DBStream extends stream.Readable {
@palimphread
palimphread / soup.io.sh
Last active July 11, 2020 21:15 — forked from fadenb/soup.io.sh
Script for downloading all images posted on a soup (soup.io)
#!/usr/bin/env bash
# Author: Mike Herwig
# Description: Script for downloading all images posted on a soup (soup.io)
#where to download from
HOST="suckup.soup.io"
#this is the regex for matching the images, you might want to update it when soup.io changes their urls
# 2017-02-14: Updated regex to catch new and old URLs
@planetceres
planetceres / RESET_USB_KERNEL_MODULE.md
Last active April 7, 2025 20:21
Restart/reset USB kernel module in Ubuntu 18.04 without rebooting
@SirPepe
SirPepe / draft.txt
Created February 19, 2021 11:39
Grundgesetz für Web Components
Grundgesetz für Web Components
------------------------------
§ 1 Web Components sind HTML-Elemente und müssen sich wie HTML-Elemente verhalten. Sie sind kein 1:1-Ersatz für andere Komponenten-Konzepte, sondern universelle, einfach zu benutzende Erweiterungen des HTML-Vokabulars. Ihre Attribute und APIs müssen so konzipiert sein, das sie HTML-Autoren nicht überraschen. Das stellt sicher, dass Web Components universelle Plugins sind, die in jedem Browser und Framework gut funktionieren. Insbesonders zu beachten ist:
§ 1.1 Web Components müssen einen nützlichen Use Case anbieten, der allein mit HTML-Mitteln umgesetzt werden kann. JavaScript-APIs können den Funktionionsumfang einer Web Component beliebig erweitern, dürfen aber nicht zur Pflicht werden (vgl. <video>). Das stellt sicher, dass jeder Mensch, der ein bisschen HTML kann, Web Components nutzen kann.
§ 1.2 Web Components müssen Fail-Safe sein. Sie dürfen keine JavaScript-Exceptions werfen sondern müssen wie native HTML-Elemente mit jeder Art von
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2025 12:29
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@LilithWittmann
LilithWittmann / autobahn.md
Last active January 14, 2025 12:25
autobahn.md