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 EVENTS_AT_A_TIME = 10; | |
| const MAX_CHECK_INTERVAL = 500; | |
| const WAIT_PER_EVENT = MAX_CHECK_INTERVAL / EVENTS_AT_A_TIME; | |
| export function listenToEvents(knex, table, name, callback) { | |
| let lastEventId; | |
| const cursor = table + "::" + name; | |
| async function getCursorPosition(): Promise<number> { |
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
| // produces unique enough base36 serial based on nanosecond time | |
| function makeUpgradeCode() { | |
| const [nanoseconds, seconds] = process.hrtime(); | |
| const time = (seconds * 1e6 + nanoseconds) | |
| .toString(26) | |
| .split('') | |
| .map(x => (parseInt(x, 26) + 10).toString(36)) | |
| .concat(Math.random().toString(10).substring(2).split('')) | |
| .slice(0, 12); | |
| const [a, b, c, d, e, f, g, h, i, j, k, l] = time; |
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 [ns, s] = process.hrtime(); | |
| const nsTime = (s * 1e6 + ns); | |
| function encode(num, digits = 15, off = 0) { | |
| const rand = off ? Math.random().toString(26).substring(1, 1 + off) : ''; | |
| const str = (num.toString(26) + rand).split(''); | |
| let input = str.map(ch => ch === '.' ? '-' : (parseInt(ch, 26) + 10).toString(36)).join('').toUpperCase(); |
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
| Extend size of disk and then boot into vm. | |
| # fix up partition size | |
| sudo parted -l | |
| Fix | |
| # file up partition | |
| sudo fdisk /dev/sda |
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 fs = require("fs"); | |
| const path = require("path"); | |
| const FILE_REGEXP = /^([a-z]+)-([a-z_]+)-.*[.]csv$/; | |
| const filename = process.argv[process.argv.length - 1] || ''; | |
| const basename = path.basename(filename); | |
| if (!filename || !basename || !basename.match(FILE_REGEXP)) { | |
| throw Error('A csv file input must be specified of the format <centreId>-<parkerType>-<date>.csv. E.g. kotara-westfield_secondary-2021-01-01.csv'); | |
| } |
OlderNewer