This file contains 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 AWS = require('aws-sdk'); | |
console.log(process.env); | |
var sts = new AWS.STS(); | |
sts.getCallerIdentity({}, | |
(err, data) => err && console.log("Error", err) || console.log(JSON.stringify(data.Account))); |
This file contains 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 run -it --rm debian:bullseye-slim /bin/bash | |
root@789bc626502d:/# apt update && apt install -y git build-essential cmake | |
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB] | |
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB] | |
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB] | |
Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB] | |
Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [234 kB] | |
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB] | |
Fetched 8640 kB in 4s (2393 kB/s) | |
Reading package lists... Done |
This file contains 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
# Remove commit from current branch. Remote branch is MINE: I dont care about other people's commits (bad). | |
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force | |
# Remove commit from current branch. Remote branch is SHARED: Be careful with other people's commits. | |
git rebase --onto $COMMIT_HASH^ $COMMIT_HASH && git push --force-with-lease | |
# Alternate to rebasing | |
git reset --soft $COMMIT_HASH_BEFORE_CHANGES or HEAD~$NO_COMMITS_BEHIND | |
git stash | |
git checkout uat |
This file contains 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 http = require('http'); | |
const server = http.createServer(); | |
server.on('request', (request, response) => { | |
let body = []; | |
request.on('data', (chunk) => { | |
body.push(chunk); | |
}).on('end', () => { | |
body = Buffer.concat(body).toString(); |
This file contains 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
for DB in $(mysql -u root -p<password> -h <IP of DB> -e 'show databases' -s --skip-column-names); do | |
mysqldump -u root -p<password> -h<IP of DB> $DB > "$DB.sql"; | |
This file contains 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 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 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 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 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.'); | |
// |