This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Roll your own DDNS | |
# Shell script to update namecheap.com dynamic dns | |
# for a domain to your external IP address | |
HOSTNAME=$MYSUBDOMAIN | |
DOMAIN=$MYDOMAIN | |
PASSWORD=$MYSECRETPASSWORD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* This is a POC of https://github.com/nodejs/modules/issues/152#issuecomment-1068515887 | |
* | |
* The requires statement below should fail with an error while | |
* using an ESM import buried inside the module dependency chain: | |
* import crypto from 'crypto'; | |
* ^^^^^^ | |
* SyntaxError: Cannot use import statement outside a module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Import dependencies | |
const bip32 = require('bip32') | |
const bip39 = require('bip39') | |
const bitcoin = require('bitcoinjs-lib') | |
//Define the network | |
const network = bitcoin.networks.bitcoin //use networks.testnet for testnet | |
// Derivation path | |
const path = `m/49'/0'/0'/0` // Use m/49'/1'/0'/0 for testnet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1 Openssh server | |
sudo apt install -y openssh-server | |
sudo systemctl enable ssh | |
sudo systemctl start ssh | |
sudo ufw enable | |
sudo ufw allow ssh | |
#2 Docker (https://docs.docker.com/engine/install/ubuntu/) | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER | |
// @see https://en.wikipedia.org/wiki/Double-precision_floating-point_format | |
console.log(Number.MAX_SAFE_INTEGER); | |
const z = 4153000000000000000 + 99; | |
console.log(z); | |
console.log('Thats why.'); | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const util = require('util'); | |
setTimeout(async () => { | |
db.getData = util.promisify(db.getData); | |
db.processData = util.promisify(db.processData); | |
db.saveData = util.promisify(db.saveData); | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `docker:latest` image uses base alpine linux | |
# This script allows installing awscliv2 which requires | |
# gcc buildtools (instead of default `musl` in alpine) | |
# https://stackoverflow.com/questions/60298619/awscli-version-2-on-alpine-linux | |
GLIBC_VER=2.31-r0 | |
# install glibc compatibility for alpine | |
apk --no-cache add \ | |
binutils \ | |
jq \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. SET YOUR GROUP REGISTRATION TOKEN | |
# @see https://gitlab.com/groups/mygroup/-/settings/ci_cd#runners-settings | |
export GITLAB_REGISTRATION_TOKEN=abc123def456 | |
# 1. INSTALL GITLAB RUNNER | |
# @see https://docs.gitlab.com/runner/install/linux-repository.html | |
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash | |
export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt-get install gitlab-runner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pass the env-vars to MYCOMMAND | |
eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
# … or ... | |
# Export the vars in .env into your shell: | |
export $(egrep -v '^#' .env | xargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
module.exports = function(data) { | |
return crypto.createHash('md5').update(data).digest("hex"); | |
}; |