This code has been moved to a GitHub repository with the corresponding license. https://github.com/UngarMax/TelnetServer
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]) |
"use strict"; | |
let looper = (callback) => { | |
let n = 2000000; | |
while (n > 0) { | |
callback(n); | |
n--; | |
} | |
} |
function Semaphore(max) { | |
var counter = 0; | |
var waiting = []; | |
var take = function() { | |
if (waiting.length > 0 && counter < max){ | |
counter++; | |
let promise = waiting.shift(); | |
promise.resolve(); | |
} |
@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)) |
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);
};
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`
This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import
package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).
For each of the provided functionalities, you need a connected IDBDatabase
instance.
import { idb } from 'some-database'