Skip to content

Instantly share code, notes, and snippets.

View jgermade's full-sized avatar
🎨
Working from home

Jesús Germade jgermade

🎨
Working from home
View GitHub Profile
#!/usr/bin/env node
process.stdin.resume()
process.stdin.setEncoding('utf8')
function envsubst (str) {
return str
.replace(/\${ *([^}]+?) *}/g, (matched, var_name) => {
return process.env[var_name] || matched
})
@jgermade
jgermade / Makefile
Created February 26, 2021 15:40
override and aliasing environment variables in Makefile
# API=staging if not defined
ifndef API
export API=staging
endif
# API=dev as an alias for API=development
ifeq ($(API),dev)
override API=development
export API
const resolved = Promise.resolve()
const nextTick = fn => resolved.then(fn)
const _runListeners = (thisArg, args, listeners, runAfter = fn => fn()) => {
listeners?.forEach(listener => runAfter(() => listener.apply(thisArg, args)))
}
export function EventEmitter (context = null) {
const _events = {}
const fetch = require('node-fetch')
const fs = require('fs')
const qs = require('qs')
const { chromium } = require('playwright')
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
@jgermade
jgermade / repeated postcodes
Last active November 18, 2021 16:05
multiple postcodes
// from:
// https://raw.githubusercontent.com/codeforspain/ds-codigos-postales/callejero-ine/data/codigos_postales_municipios_join.csv
10110: 2
10170: 2
10182: 2
10185: 2
10189: 4
10190: 2
10198: 2
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,38,00,1d,00,1d,00,38,00,00,00,00,00
; 00,00,00,00 Header: Version. Set to all zeroes.
; 00,00,00,00 Header: Flags. Set to all zeroes.
; 05,00,00,00 5 entries in the map (including null entry).
; 38,00,1d,00 Left CTRL -> Left ALT (can also be another key).
; 1d,00,38,00 Left ALT -> Left CTRL.