Skip to content

Instantly share code, notes, and snippets.

View reconbot's full-sized avatar
🏴‍☠️
Building at @github

Francis Gulotta reconbot

🏴‍☠️
Building at @github
View GitHub Profile
@reconbot
reconbot / mouse-parser.js
Last active August 24, 2019 01:36
This parses the ms serial mouse wire protol into randomly named events.
const { Transform } = require('stream')
const debug = require('debug')('serialport/mouse-parser')
const StartByteMarkerByte = 0b01000000
const LeftMouseButtonByte = 0b00100000
const RightMouseButtonByte = 0b00010000
const isStart = byte => byte & StartByteMarkerByte
const DEFAULT_STATE = Object.freeze({
### STARTED Filters for GitHub Actions 03:52:54Z
Pulling image: gcr.io/github-actions-images/action-runner:latest
latest: Pulling from github-actions-images/action-runner
cd784148e348: Already exists
23e2dcc28013: Pulling fs layer
1b231fbdf683: Pulling fs layer
bd89504cdd3c: Pulling fs layer
ad8707eb42ef: Pulling fs layer
ad8707eb42ef: Waiting
@reconbot
reconbot / .tesselinclude
Created November 26, 2018 04:28
My hanging js codee
node_modules/blynk-library/certs/server.crt
@reconbot
reconbot / dumpmysql.js
Created October 19, 2018 14:11
This dumps every table in every mysql db to a file in ndjson format for loading into bigquery
const { pipe, transform } = require('bluestream')
const mysql = require('mysql')
const { createWriteStream } = require('fs')
const connection = mysql.createConnection({
socketPath: '/var/run/mysqld/mysqld.sock',
user: 'root',
password: 'root',
dateStrings: true,
})
import childProcess from 'child_process'
import { Readline } from '@serialport/parser-readline'
import { PortInfo } from '@serialport/binding-abstract'
// get only serial port names
function checkPathOfDevice(path: string) {
return /(tty(S|ACM|USB|AMA|MFD|O)|rfcomm)/.test(path) && path
}
type PropName = 'DEVNAME' | 'ID_VENDOR_ENC' | 'ID_SERIAL_SHORT' | 'ID_VENDOR_ID' | 'ID_MODEL_ID' | 'DEVLINKS'
const Benchmark = require('benchmark')
const Bl = require('./bl')
Bl.prototype.oldSlice = function slice (start, end) {
if (typeof start == 'number' && start < 0){
start += this.length
}
if (typeof end == 'number' && end < 0){
end += this.length
}
@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"