ArrayBuffer.from = (string) => Uint8Array.from(string.split('').map(e => e.charCodeAt(0))).buffer;
let challenge = ArrayBuffer.from('super hard challenge created in server');
let id = ArrayBuffer.from('id created in server')
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
// Tested on node 18 | |
// The result is sequential | |
function rand_promise(i) { | |
return new Promise((r) => { | |
const timeout = Math.random() * 1000; | |
setTimeout(() => r(i), timeout); | |
}); | |
} |
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
{ | |
"CGB": { | |
"city": "Cuiabá", | |
"country": "Brazil" | |
}, | |
"COR": { | |
"city": "Córdoba", | |
"country": "Argentina" | |
}, | |
"BTS": { |
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
server { | |
listen 80; | |
server_name pgw.bottomatik.com; | |
rewrite ^ https://$server_name$request_uri? permanent; | |
} | |
server { | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_min_length 256; |
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
Verifying my Blockstack ID is secured with the address 12ZijDjYwb1us93s3JT8JMXKs2f8FBE1aa https://explorer.blockstack.org/address/12ZijDjYwb1us93s3JT8JMXKs2f8FBE1aa |
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
if (process.argv && process.argv.indexOf('-v') > -1) { | |
const { name, version } = require('./package.json'); | |
return console.log(`${name} version ${version}`); | |
} | |
/* | |
Example: | |
node mystuff.js -v | |
> mystuff version 3.0.4 |
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
// INSTRUCTIONS | |
/* | |
* 1) Run node sigint.js and call ctrl-c, then wait 1 second (for process to exit) | |
* Expected output: SIGINT 1 | |
* | |
* 2) Run npm start (see end of file for example, which runs node sigint.js) and call ctrl-c, then wait 1 second (for process to exit) | |
* Expected output SIGINT 1 | |
* Unexpected output SIGINT 2 | |
*/ |
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 fs = require('fs'); | |
console.time('Reading CSV...'); | |
let csv = fs.readFileSync('./rocket.csv', {encoding: 'utf8'}); | |
console.timeEnd('Reading CSV...'); | |
let lines = csv.split('\n'); | |
let names = lines.splice(0,1)[0].split(';'); | |
console.log('Got names', names.join(', ')); | |
console.log('And', lines.length, 'lines'); |
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
[alias] | |
magic = "!sh -c 'git checkout \"$1\" && git pull && git checkout \"$0\" && git rebase \"$1\"'" |
NewerOlder