Skip to content

Instantly share code, notes, and snippets.

@valgaze
valgaze / upload.md
Last active October 15, 2023 10:50
Voiceflow KB Upload
// Sawp in VF ACCESS_TOKEN below, have text file bongo.txt in same directory as script
// Run with node (18+ for Fetch/FormData): $ node index.js

// CONFIG
const ACCESS_TOKEN = `VF.DM.XXXXXX`;
const FILE_NAME = "bongo.txt"; // Same directory as the script

const fs = require("fs");
@valgaze
valgaze / base64ArrayBuffer.js
Created June 17, 2022 16:24 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@valgaze
valgaze / index.js
Last active May 11, 2022 14:40
Serverless-stack (SST) clever websocket in lambda (https://anoma.ly/)
/**
* Note: 4 cases where a websocket connection might be closed
* 1. closed while waiting for response + idle longer than 10min => send keep-alive after 9min
* 2. closed while waiting for response + 2hr connection limit => a new connection will be used
* 3. closed while not waiting + idle longer than 10min => detect close callback and resend
* 4. closed while not waiting + 2hr connection limit => a new connection will be used
* 5. closed while connecting => do not retry
* ie. ENOTFOUND: debug stack is removed and the websocket endpoint does not exist.
* 6. closed while sending message => do not retry
* ie. Code: 1009 Error: Max frame length of 32768 has been exceeded.
@valgaze
valgaze / $uperpowers.md
Last active November 16, 2021 14:46
🌟 speedybot $uperpowers
@valgaze
valgaze / snapwebex.md
Created July 15, 2021 21:43
Set up snap camera

1. Get the Snap camera (MAC/PC): https://snapcamera.snapchat.com/download

2. Proceed through installation

3. Open Snap Camera app and pick a fiter

pickfilter

4. Open a WebEx session & select the dropdown next to video and switch video to "Snapchat Camera"

@valgaze
valgaze / GTA5VR_101.md
Last active August 14, 2025 13:28
GTA5 VR (R.E.A.L.)

Quickstart

Step 0: Pre-requisites

  • Get a tool that can unpack Rar files (A good option is WinRar but many others exist as well)

  • Install a clean copy (ideally no modifications to start) of GTAV & note the location where GTA5.exe is installed

Note: At time of writing, the mod is compatible with the latest game update released by Rockstar on Aug 11, 2020 v1.0.2060.0 & should be work previous versions down to 1.0.1180.2)

@valgaze
valgaze / actions-on-google.md
Last active May 11, 2020 17:16
DialogFlow Payloads

Actions On Google

simpleResponse, basicCard, carouselBrowse, mediaResponse, tableCard

Rich Response Items
@valgaze
valgaze / documentdb.md
Created July 25, 2019 02:40
Connect to AWS DocumentDB

** Context: ** DocumentDB has no public endpoints and lives in its own VPC, the upshot of which is that to interact with the data (ie get a shell) you must tunnel/hop through an EC2 instance in the same VPC as the DocumentDB cluster

0) Start up a "helper instance" in same VPC as the DocumentDB Cluster

  • SSH to the instance

1) Setup instance to work with mongo

@valgaze
valgaze / strings.js
Created October 6, 2018 20:10
moment.js timezone strings
// moment.tz.names()
const allZones = [
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmara",
"Africa/Asmera",
"Africa/Bamako",
"Africa/Bangui",
@valgaze
valgaze / doc.md
Created March 27, 2018 03:27
"Slow-start guide to React-Sketchapp"

Step 0: Gather all your tools

Before getting started with react-sketch-app you should have all the following tools installed and ready to go:

  • A terminal program (if you are not very comfortable using the command line, this guide should teach you most of the basic commands to get up and running)

  • Sketch

  • A Text editor (Atom or Sublime Text are straightforward choices with which to start and both have many of tutorials available online)