Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Researching the Passion Economy

Travis Fischer transitive-bullshit

:octocat:
Researching the Passion Economy
View GitHub Profile
View .bashrc
alias ..='cd ..;ls'
alias ...='cd ../..;ls'
alias ....='cd ../../..;ls'
alias .....='cd ../../../..;ls'
alias ......='cd ../../../../..;ls'
alias .......='cd ../../../../../..;ls'
alias ........='cd ../../../../../../..;ls'
alias .........='cd ../../../../../../../..;ls'
alias ..........='cd ../../../../../../../../..;ls'
View gist:615fdc8c81a19da94017566c16c4d064
GRPC_TRACE=all GRPC_VERBOSITY=DEBUG node benchmark-multiple-gets.js
using gRPC via @google-cloud/firestore
2020-03-27T19:51:39.594Z | resolving_load_balancer | firestore.googleapis.com:443 IDLE -> IDLE
2020-03-27T19:51:39.594Z | connectivity_state | firestore.googleapis.com:443 IDLE -> IDLE
2020-03-27T19:51:39.595Z | dns_resolver | Resolver constructed for target firestore.googleapis.com:443
2020-03-27T19:51:39.598Z | channel | firestore.googleapis.com:443 createCall [0] method="/google.firestore.v1.Firestore/BatchGetDocuments", deadline=Fri Mar 27 2020 15:56:39 GMT-0400 (Eastern Daylight Time)
2020-03-27T19:51:39.599Z | call_stream | [0] Sending metadata
2020-03-27T19:51:39.599Z | channel | Pick result: QUEUE subchannel: undefined status: undefined undefined
2020-03-27T19:51:39.600Z | call_stream | [0] write() called with message of length 117
2020-03-27T19:51:39.601Z | call_stream | [0] end() called
View gist:d37cb5885f36b6ec0a166742af646cfd
master* in ~/dev/saasify/temp/gcp-test $ yarn why @grpc/grpc-js
yarn why v1.22.0
[1/4] 🤔 Why do we have the module "@grpc/grpc-js"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "@grpc/grpc-js@0.7.4"
info Has been hoisted to "@grpc/grpc-js"
info This module exists because it's specified in "dependencies".
View wordcloud.openapi.json
{
"openapi": "3.0.2",
"info": {
"title": "Fast API",
"version": "0.1.0"
},
"paths": {
"/stylecloud": {
"post": {
"responses": {
View grpc output.txt
GRPC_TRACE=all GRPC_VERBOSITY=DEBUG node benchmark-multiple-gets.js
D0326 16:48:14.918318000 4490681792 dns_resolver.cc:294] Using native dns resolver
I0326 16:48:14.918674000 4490681792 timer_manager.cc:88] Spawn timer thread
I0326 16:48:14.918704000 4490681792 init.cc:164] grpc_init(void)
I0326 16:48:14.918728000 123145542873088 timer_manager.cc:250] timers not checked: expect another thread to
I0326 16:48:14.918742000 123145542873088 timer_manager.cc:197] sleep until kicked
I0326 16:48:14.919055000 4490681792 completion_queue.cc:504] grpc_completion_queue_create_internal(completion_type=0, polling_type=0)
using gRPC via @google-cloud/firestore
I0326 16:48:15.248755000 4490681792 ssl_credentials.cc:130] grpc_ssl_credentials_create(pem_root_certs=(null), pem_key_cert_pair=0x0, verify_options=0x7ffeefbfe520, reserved=0x0)
I0326 16:48:15.256503000 4490681792 plugin_credentials.cc:250] grpc_metadata_credentials_creat
View imagemin-axios-buffer-example.js
const axios = require('axios');
async function main () {
const getImg = (url) => {
return axios.get(url, { responseType: 'arraybuffer' });
}
const url = 'https://octodex.github.com/images/original.png';
const original = await getImg(url);
console.log('original', { status: original.status, size: original.data.length });
View imagemin-axios-url-example.js
const axios = require('axios');
async function main () {
const url = 'https://octodex.github.com/images/original.png';
const optimized = await axios.post('https://ssfy.sh/dev/imagemin/optimizeImageUrl', { url }, {
responseType: 'arraybuffer'
});
console.log('optimized', { status: optimized.status, size: optimized.data.length });
View sha256-1.js
const crypto = require('crypto')
const hash = (d) => {
const buffer = Buffer.isBuffer(d) ? d : Buffer.from(d.toString())
return crypto.createHash('sha256').update(buffer).digest('hex')
}
View sha256-0.js
const hasha = require('hasha')
const hash = (input) => hasha(input, { algorithm: 'sha256' })
View content-based-hash.js
const pick = require('lodash.pick')
const stableStringify = require('fast-json-stable-stringify')
const data = pick(myData, ['keyFoo', 'keyBar'])
const fingerprint = hash(stableStringify(data))