Skip to content

Instantly share code, notes, and snippets.

View Naddiseo's full-sized avatar

no Naddiseo

  • n/a
  • earth
View GitHub Profile
@Jaid
Jaid / migratingRules.md
Last active February 21, 2024 10:48
ESLint rules for migrating projects from CommonJS to ESM

ESLint rules

The ESM standard is considered stable in NodeJS and well supported by a lot of modern JavaScript tools.

ESLint does a good job validating and fixing ESM code (as long as you don't use top-level await, coming in ESLint v8). Make sure to enable the latest ECMA features in the ESLint config.

  • .eslint.json
{
@sindresorhus
sindresorhus / esm-package.md
Last active September 20, 2024 23:01
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.
@oidualc
oidualc / userChrome.css
Last active February 7, 2020 20:27
Firefox Client Side Decorations: close, minimize, maximize on the left
#TabsToolbar {
direction: rtl;
}
#tabbrowser-tabs {
direction: ltr;
}
.titlebar-buttonbox {
display: flex;
@WebReflection
WebReflection / es.mjs
Last active February 15, 2018 08:31
A loader for both `.mjs` and `.m.js` extension.
import _url from 'url';
const builtins = new Set(
Object.keys(process.binding('natives')).filter(str =>
/^(?!(?:internal|node|v8)\/)/.test(str))
);
const esmIfExplicit = url => {
const eof = url.slice(-5);
return {
@RCasatta
RCasatta / seed2keys.py
Last active May 23, 2021 09:08 — forked from kumrzz/seed2keys.py
Creates public and private keys from Electrum 2.0 seed
#!/usr/bin/env python
''' Run from "electrum/lib" directory.
ThomaxV started a discussion on https://bitcointalk.org/index.php?topic=274182.msg2939599#msg2939599
about changing the HD derivation logic in electrum 2. The below post:
http://bitcoin.stackexchange.com/questions/37013/how-to-import-a-hd-wallet-from-an-extended-private-key
confirms that the format is actually m/c/i (and not m/44'/0'/a'/c/i)
so I have altered https://gist.github.com/romanz/4b32782bfc0ff4984713 accordingly:
tested to work with keys/addresses exported from electrum 2.7.0
note Electrum has a "gap limit" of 20, so loop @ level "c" to get the next 20 addresses
'''
@mapmeld
mapmeld / OverEncrypt.md
Last active July 25, 2023 18:55
OverEncrypt - paranoid HTTPS

OverEncrypt

This is a guide that I wrote to improve the default security of my website https://fortran.io , which has a certificate from LetsEncrypt. I'm choosing to improve HTTPS security and transparency without consideration for legacy browser support.

WARNING: if you mess up settings, lose your certificates, or decide to no longer maintain HTTPS certs, these steps can and will make your domain inaccessible.

I would recommend these steps only if you have a specific need for information security, privacy, and trust with your users, and/or maintain a separate secure.example.com domain which won't mess up your main site. If you've been thinking about hosting a site on Tor, then this might be a good option, too.

The best resources that I've found for explaining these steps are https://https.cio.gov , https://certificate-transparency.org , and https://twitter.com/konklone

@alanhamlett
alanhamlett / amqp.py
Last active October 22, 2021 21:18
send an error email when a Celery worker raises an unhandled exception
# -*- coding: utf-8 -*-
"""
wakatime.amqp
~~~~~~~~~~~~~
Setup for Celery distributed task queue.
"""
import socket
@haf
haf / install-git.sh
Created August 22, 2012 14:38
Installing git and git-subtree from source in ubuntu as packages
# use with: curl -L https://raw.github.com/gist/3426227 | bash
# get git binary, then git with git
sudo apt-get install git -y
git clone https://github.com/git/git.git
# remove your binary/package
sudo apt-get remove git -y
sudo apt-get install make checkinstall libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc -y