Skip to content

Instantly share code, notes, and snippets.

View reconbot's full-sized avatar
🏴‍☠️

Francis Gulotta reconbot

🏴‍☠️
View GitHub Profile
@reconbot
reconbot / blperftest.js
Last active October 9, 2018 17:44
perf test indexof
const Benchmark = require('benchmark')
const Bl = require('./')
const smallBuffers = new Bl(new Array(100).fill(1).map(() => Buffer.alloc(8, 1)))
const largeBuffers = new Bl(new Array(100).fill(1).map(() => Buffer.alloc(1024, 1)))
const mixedBuffers = new Bl(new Array(100).fill(1).map((val, i) => Buffer.alloc(i ** 2 % 1024, 1)))
const veryLargeBuffers = new Bl(new Array(100).fill(1).map(() => Buffer.alloc(1024 * 1024, 1)))
const notFindableSmall = Buffer.alloc(7, 0)
const notFindableMedium = Buffer.alloc(510, 0)
@reconbot
reconbot / check-download-stats.js
Last active May 6, 2018 23:00
A small script to query github releases for download counts, summarizing them by ia32 or not in their file name. Working on providing data for the decision to drop ia32 support for node 10 https://github.com/nodejs/build/issues/885#issuecomment-386893606
#!/usr/bin/env node
const r2 = require('r2');
const API_HOST = 'https://api.github.com/graphql';
const PUBLIC_READ_TOKEN = 'XXX'; // (only needs public repo scope)
const query = `
query {
repository(owner: "node-serialport", name: "node-serialport") {
nameWithOwner
owner {
@reconbot
reconbot / .block
Last active November 30, 2017 00:53 — forked from mbostock/.block
Pie Chart
license: gpl-3.0
{
"Image": {
"3900284": [
"No validator for Image 'o:HasMedia': 1"
],
"3900287": [
"No validator for Image 'o:HasMedia': 1"
],
"3900290": [
"No validator for Image 'o:HasMedia': 1"
{
"FeatureZone": {
"2481425": [
"count === 1 failed with 2 for 's:HasClip'"
],
"3077671": [
"count === 1 failed with 0 for 's:HasClip'"
],
"3206466": [
"count === 1 failed with 2 for 's:HasClip'"
This file has been truncated, but you can view the full file.
{
"2": 1446852245925,
"3": 1446852245925,
"4": 1446852245924,
"5": 1446852245924,
"6": 1446852245924,
"7": 1446852245924,
"8": 1446852245924,
"9": 1446852245924,
"10": 1446852245923,
This file has been truncated, but you can view the full file.
{
"2": 1446852245925,
"3": 1446852245925,
"4": 1446852245924,
"5": 1446852245924,
"6": 1446852245924,
"7": 1446852245924,
"8": 1446852245924,
"9": 1446852245924,
"10": 1446852245923,
function decodeHexEscape(str) {
return str.replace(/\\x([a-fA-F0-9]{2})/g, (a, b) => {
return String.fromCharCode(parseInt(b, 16));
});
}
@reconbot
reconbot / copy-exif-time.js
Created July 25, 2017 03:40
Quick and dirty exif created at time to file modification time copy
const fs = require('fs')
const Promise = require('bluebird')
const moment = require('moment')
const { promisify } = require('util')
const touch = promisify(require('touch'))
var getExifData = promisify(require('exif').ExifImage)
const readdir = promisify(fs.readdir)
const stat = promisify(fs.stat)
★ thunk-redis git:(master) ✗ node benchmark
redis(redis): node_redis OK
redis(thunk-redis):thunk-redis OK
redis(ioredis): ioRedis OK
Bench start:(100000)
PING concurrency(full thread):
redis(redis): 1058ms 94517ops/sec 100%
redis(thunk-redis): 1117ms 89525ops/sec 94.7%