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
| // --------------------------------------------------------- | |
| // Bun.serve | |
| const server = Bun.serve({ | |
| port: 0, | |
| fetch: async (req) => { | |
| const url = new URL(req.url); | |
| switch (url.pathname) { | |
| case "/json": | |
| const jsonResponse = { | |
| message: "Hello, World!", |
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
| // Timer helper | |
| class Timer { | |
| constructor() { | |
| this.t = process.hrtime.bigint(); | |
| } | |
| end() { | |
| return Number((process.hrtime.bigint() - this.t)/BigInt(1000))/1000; | |
| } | |
| }; |
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
| Characteristics | |
| Node | |
| - Public Key | |
| - Private Key | |
| - Current public address (TCP Address, own if public node, closest public node if restricted node) | |
| - UUID (UUID, constant) | |
| If public port available, same as Private Address, else closest available public node | |
| - Public Address Slots [10] | |
| Slots used for opening tunnels to the closest private nodes |
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
| Characteristics | |
| Node | |
| - Public Key | |
| - Private Key | |
| - Current public address (TCP Address, own if public node, closest public node if restricted node) | |
| - UUID (UUID, constant) | |
| If public port available, same as Private Address, else closest available public node | |
| - Public Address Slots [10] | |
| Slots used for opening tunnels to the closest private nodes |
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
| Characteristics | |
| Node | |
| - Public Key | |
| - Private Key | |
| - Current public address (TCP Address, own if public node, closest public node if restricted node) | |
| - UUID (UUID, constant) | |
| If public port available, same as Private Address, else closest available public node | |
| - Public Address Slots [10] | |
| Slots used for opening tunnels to the closest private nodes |
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
| // Stat the file using uv | |
| uv_fs_t stat_req; | |
| stat_req.data = this; | |
| // Run stat, store result and call ready callback | |
| uv_fs_stat(uv_default_loop(), &stat_req, (const char *)composite.c_str(), [](uv_fs_t* req) { | |
| File* self = static_cast<File*>(req->data); |
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
| function relativeToAbsoluteHumidity(celsius,rh) { | |
| var ah = 4.7815706 | |
| +0.34597292*celsius | |
| +0.0099365776*Math.pow(celsius,2) | |
| +0.00015612096*Math.pow(celsius,3) | |
| +0.0000019830825*Math.pow(celsius,4) | |
| +0.000000015773396*Math.pow(celsius,5); | |
| return ah * rh / 100; | |
| } |
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 | |
| deepExtend = require('deep-extend'), | |
| deepmerge = require('deepmerge'), | |
| klon = require('klon'), | |
| jonas = (function () { | |
| const toString = Object.prototype.toString; | |
| function isMergeable (value) { | |
| return value && typeof value === 'object' && toString.call(value) !== '[object Date]' && toString.call(value) !== '[object RegExp]'; | |
| } |
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
| func TetrominoFactory() Tetromino { | |
| var tt rune = implementedTetrominos[rand.Intn(len(implementedTetrominos))] | |
| switch tt { | |
| case 'I': | |
| return Tetromino{tt, []Sprite{ | |
| Sprite{[]Vector{{0, 1}, {1, 1}, {2, 1}, {3, 1}}}, | |
| Sprite{[]Vector{{2, 0}, {2, 1}, {2, 2}, {2, 3}}}, | |
| Sprite{[]Vector{{0, 2}, {1, 2}, {2, 2}, {3, 2}}}, | |
| Sprite{[]Vector{{1, 0}, {1, 1}, {1, 2}, {1, 3}}}, |
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 telnet = require('telnet-client'); | |
| var connection = new telnet(); | |
| var params = { | |
| host: 'horizons.jpl.nasa.gov', | |
| port: 6775, | |
| shellPrompt: 'Horizons> ', | |
| timeout: 5000 | |
| }; |
NewerOlder