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 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 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 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 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 |
OlderNewer