Skip to content

Instantly share code, notes, and snippets.

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

Celmaun celmaun

🏠
Working from home
View GitHub Profile
@celmaun
celmaun / deferred_promise.js
Created April 25, 2021 09:59 — forked from oliverfoster/deferred_promise.js
Deferred promise
class DeferredPromise extends Promise {
constructor(def = (res, rej)=>{}) {
let res, rej;
super((resolve, reject)=>{
def(resolve, reject);
res = resolve;
rej = reject;
});
this.resolve = res;
@celmaun
celmaun / docker-etc-hosts-install.sh
Last active December 10, 2024 12:02
Installs docker container names and IP addresses in /etc/hosts https://x.com/Celmaun/status/1866434295805456807
#!/usr/bin/env bash
# vim:set ft=bash ts=4 sw=4 et :
# shellcheck shell=bash
# shellcheck disable=SC2317
## Usage:
## docker-etc-hosts-install
## Installs docker container names and IP addresses in /etc/hosts
## This script is idempotent
## Note: Requires root privileges to write to /etc/hosts