Based on https://stackoverflow.com/a/31632215/761771
const reduceOp = function(args, reducer){
args = Array.from(args);
args.pop(); // => options
var first = args.shift();
return args.reduce(reducer, first);
};
/** | |
* Export all data from an IndexedDB database | |
* | |
* @param {IDBDatabase} idbDatabase The database to export from | |
* @return {Promise<string>} | |
*/ | |
export function exportToJson(idbDatabase) { | |
return new Promise((resolve, reject) => { | |
const exportObject = {} | |
if (idbDatabase.objectStoreNames.length === 0) { |
function Semaphore(max) { | |
var counter = 0; | |
var waiting = []; | |
var take = function() { | |
if (waiting.length > 0 && counter < max){ | |
counter++; | |
let promise = waiting.shift(); | |
promise.resolve(); | |
} |
Based on https://stackoverflow.com/a/31632215/761771
const reduceOp = function(args, reducer){
args = Array.from(args);
args.pop(); // => options
var first = args.shift();
return args.reduce(reducer, first);
};
"use strict"; | |
let looper = (callback) => { | |
let n = 2000000; | |
while (n > 0) { | |
callback(n); | |
n--; | |
} | |
} |
@echo off | |
:: | |
:: logrotate.bat - Log rotation for windows | |
:: | |
:: Usage: logrotate.bat filename maxfilecount [maxfilesize] | |
:: | |
:: filename : The file name to rotate. | |
:: maxfilecount: Number of backup files. | |
:: maxfilesize : Rotated if the size of file exceeds specified size. | |
:: (Default is 0. Unit notation is available (K, M and G)) |
class KeyifyList(object): | |
def __init__(self, inner, key): | |
self.inner = inner | |
self.key = key | |
def __len__(self): | |
return len(self.inner) | |
def __getitem__(self, k): | |
return self.key(self.inner[k]) |
This code has been moved to a GitHub repository with the corresponding license. https://github.com/UngarMax/TelnetServer
If you want to go from 32 to 64 bit Cygwin but keep all the packages[1], you might find yourself in a spot where you would like to export the list of cygwin packages and also be able to install cygwin with all these packages again. I will tell you how. Open your Cygwin shell and enter
cygcheck -c -d | sed -e "1,2d" -e 's/ .*\$//' > packagelist
This will simply dump a list of installed packages. To install Cygwin 64 with these packages selected, download setup-x86_64[2] and execute it with the command line parameters
./setup-x86_64 -P `awk 'NR==1{printf \$1}{printf ",%s", \$1}' packagelist`