Skip to content

Instantly share code, notes, and snippets.

View Mongo4Manager
const chalk = require('chalk')
// used to keep the connection to mongo alive
// tested with mongodb@4 nodejs driver
class Mongo4Manager {
mongoHandle = null
constructor(dsn, connectionOptions = {},retryInterval = 1000, pingInterval = 1000) {
this.connectionOptions = connectionOptions
this.dsn = dsn
this.retryInterval = retryInterval
@7c
7c / data.json
Last active October 29, 2022 14:11
tu-hx
View testing.sh
#!/bin/bash
echo "ok"
@7c
7c / sha512.js
Created November 29, 2018 17:38
Browser implementation of sha512
View sha512.js
function hex(buffer) {
var hexCodes = [];
var view = new DataView(buffer);
for (var i = 0; i < view.byteLength; i += 4) {
// Using getUint32 reduces the number of iterations needed (we process 4 bytes each time)
var value = view.getUint32(i)
// toString(16) will give the hex representation of the number without padding
var stringValue = value.toString(16)
// We use concatenation and slice for padding
var padding = '00000000'
@7c
7c / .gitignore
Created December 12, 2017 05:07 — forked from iffy/.gitignore
Example using electron-updater with `generic` provider.
View .gitignore
node_modules
dist/
yarn.lock
wwwroot