Skip to content

Instantly share code, notes, and snippets.

View michaelfig's full-sized avatar

Michael FIG michaelfig

View GitHub Profile
@michaelfig
michaelfig / gentx.json
Created April 29, 2021 18:03
Sample gentx for Agoric testnet
```json
{
"body": {
"messages": [
{
"@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
"description": {
"moniker": "foo",
"identity": "",
"website": "",
4:23PM ERR Stopping peer for error err="pong timeout" module=p2p peer={"Data":{},"Logger":{}}
4:23PM ERR Connection failed @ sendRoutine conn={"Logger":{}} err="pong timeout" module=p2p peer={"id":"4c6740f6932dabfe6c5a87c5d5cfbb27623fd321","ip":"157.90.171.210","port":40720}
4:23PM ERR Stopping peer for error err="pong timeout" module=p2p peer={"Data":{},"Logger":{}}
2021-03-09T16:23:29.431Z block-manager: block 284000 commit
4:23PM ERR Connection failed @ sendRoutine conn={"Logger":{}} err="pong timeout" module=p2p peer={"id":"2798e745e49a5b5f6c9822ac271c570b1243fcd6","ip":"174.138.3.99","port":58048}
4:23PM ERR Stopping peer for error err="pong timeout" module=p2p peer={"Data":{},"Logger":{}}
4:23PM ERR Panic in RPC HTTP handler err="write tcp 188.166.47.107:26657->64.227.4.214:43500: i/o timeout" module=rpc-server stack="goroutine 2849611052 [running]:\nruntime/debug.Stack(0x7f904b16d940, 0x7f904b1ccd20, 0xc019ef27d0)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/tendermint/tendermint/rp
@michaelfig
michaelfig / 15e9*.publish
Created February 25, 2021 02:08
Snap publishing config
{"artifacts":["out/make/pledger-0.2.1.snap"],"packageJSON":{"name":"@pledger/app-electron","productName":"Pledger","private":true,"version":"0.2.1","description":"Pledger Electron frontend","main":"./src/entrypoint.cjs","repository":"https+git://github.com/agoric-labs/Pledger","workspaces":{"nohoist":["**"]},"scripts":{"start":"concurrently \"npm:ui-dev\" \"electron-forge start\"","build":"exit 0","no-postinstall":"node scripts/link-electron.cjs","postinstall":"patch-package&&cd node_modules/@pledger/plugin-agoric-app&&yarn build:electron","package":"electron-forge package","make":"electron-forge make","publish:electron":"electron-forge publish","lint":"echo \"No linting configured\"","ui-dev":"cd ../plugin-agoric-ui&&yarn dev"},"keywords":[],"author":"Agoric","license":"Apache-2.0","config":{"forge":{"packagerConfig":{"appCopyright":"Copyright 2021 Agoric Systems Operating Company, Inc.\n\nLicensed under the Apache License, Version 2.0.","executableName":"pledger","icon":"assets/agoric","appCategoryType":"pu
@michaelfig
michaelfig / membrane.js
Created February 12, 2021 01:52
Half-fast membrane implementation
// @ts-check
/**
* @typedef {({} | Function) & 'Near'} NearRef Intersection to make compatible
* only with itself.
* @typedef {({} | Function) & 'Far'} FarRef Intersection to make compatible
* only with itself.
*/
/**
@michaelfig
michaelfig / rewrite.js
Created October 5, 2020 22:11
Large table rewrite
const g = 'module-level';
const makeFooOrig = makeStoredInstanceMaker((msg = 'Hello') => {
let invocationCount = 0;
const obj = {
hello(nick) {
console.log(g, obj.getCount());
invocationCount += 1;
return `${msg}, ${nick}!`;
},
@michaelfig
michaelfig / bar.js
Last active September 12, 2020 19:11
eslint-plugin-jsdoc doesn't pick up global JSDocs like Typescript does
/**
* @typedef {123} Bar
*/
// Bar is a "global JSDoc type"
@michaelfig
michaelfig / membrane.js
Created September 7, 2020 05:01
A non-proxying membrane
// @ts-check
/**
* @typedef {({} | Function) & 'Near'} NearRef Intersection to make compatible only with itself.
* @typedef {({} | Function) & 'Far'} FarRef Intersection to make compatible only with itself.
*/
/**
* @param {*} x
*/
@michaelfig
michaelfig / subscription-loses-id.log
Created February 27, 2020 21:53
Here's the traffic in which Tendermint loses its ID (see PROBLEM)
have write {
jsonrpc: '2.0',
id: '0.2wnsjf9ekss',
method: 'subscribe',
params: { query: "tm.event = 'NewBlockHeader'" }
}
have read { jsonrpc: '2.0', id: '0.2wnsjf9ekss', result: {} }
have read {
jsonrpc: '2.0',
id: '0.2wnsjf9ekss',
@michaelfig
michaelfig / blocking-the-main-thread.js
Last active December 20, 2019 04:34
Use a Node.js worker thread with a FIFO to implement a service call that returns to the main thread synchronously.
const {
Worker,
isMainThread,
parentPort,
MessageChannel,
receiveMessageOnPort,
} = require('worker_threads');
const fs = require('fs');
const FIFO_NAME = '/tmp/wake-main-thread';

Keybase proof

I hereby claim:

  • I am michaelfig on github.
  • I am michaelfig (https://keybase.io/michaelfig) on keybase.
  • I have a public key ASCC2tgtJ_aHqtKjvdDhNev3k2WGuhjpo6V6o3DDvXblTQo

To claim this, I am signing this object: