Skip to content

Instantly share code, notes, and snippets.

View nscarlson's full-sized avatar
🌱

Nathan Carlson nscarlson

🌱
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 20, 2024 14:52
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.
@ckuethe
ckuethe / doh-blocklist.txt
Last active March 17, 2024 04:51
DNS-over-HTTPS Block List
# Here are some domains I block to interfere with DNS-over-HTTPS, so that my own DNS-based security schemes work.
# If you're going to be doing this, you should probably block all outbound 53, 853, and 5353 on your network,
# except from your own internal DNS resolver (eg. pihole)
#
# Data from https://github.com/curl/curl/wiki/DNS-over-HTTPS (and other places)
1a.ns.ozer.im
8888.google
aattwwss.duckdns.org
abel.waringer-atg.de
@rasschaert
rasschaert / !renew-certificate.sh
Last active April 11, 2024 23:38
Automatic renewal of let's encrypt certificates using docker containers and luadns
#!/bin/bash
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Run the certbot container to renew the certs
docker-compose -f /opt/docker/certbot/docker-compose.yml run --rm certbot
# Concatenate the resulting certificate chain and the private key and write it to HAProxy's certificate file.
cat /opt/docker/certbot/certbot/etc/letsencrypt/live/example.org/{fullchain,privkey}.pem > /opt/docker/haproxy/ssl/example_org.pem
@ianaya89
ianaya89 / custom-readable-stream.js
Last active November 14, 2021 11:01
Custom readable stream with node js
/* Implementation */
var stream = require('stream');
// Create the custom stream
function Num(options) {
// Inherit properties
stream.Readable.call(this, options);
this._start = 0;
this._end = 100;
@mgreau
mgreau / Gogs-Docker.adoc
Last active August 14, 2019 21:42
Gogs Docker Env (docker-compose)

Replace 192.168.99.100 by your DOCKER_HOST IP

# Configure the server
curl 'http://192.168.99.100:3000/install' \
  -H 'Origin: null' -H 'Accept-Encoding: gzip, deflate' \
  -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' \
  -H 'Upgrade-Insecure-Requests: 1' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36' \