Skip to content

Instantly share code, notes, and snippets.

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

Francis Gulotta reconbot

🏴‍☠️
View GitHub Profile
@reconbot
reconbot / batchFetchExchange.ts
Last active May 23, 2024 05:07
A batching exchange for URQL that lets you opt out of batch queries adapted form @jakubriedl's POC This version works on non persisted queries.
// Adapted from https://gist.github.com/jakubriedl/812c2a7b26927a2249a4719555d9a0ca
import DataLoader from 'dataloader'
import { Exchange, Operation } from 'urql'
import { pipe, map } from 'wonka'
interface BatchRequest {
url: RequestInfo | string
options?: RequestInit
}
@reconbot
reconbot / AsyncFunctionReturn.ts
Last active April 4, 2021 01:05
This type will unwrap an async function and give you the type of the returned promise
type AsyncFuncReturn<T> = T extends (...args: any[]) => Promise<infer U> ? U : never
// eg
const randomFunction = async () => ({ a: 4, b: "string" })
type RandomReturn = AsyncFuncReturn<typeof randomFunction>
const foo: RandomReturn = await randomFunction()

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

Hi

digraph finite_state_machine {
	rankdir=LR;
	size="8,5"
	node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
	node [shape = circle];
      
	LR_0 -&gt; LR_2 [ label = "SS(B)" ];
@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
}