Skip to content

Instantly share code, notes, and snippets.

View jpwilliams's full-sized avatar
🟪
Building Inngest

Jack Williams jpwilliams

🟪
Building Inngest
View GitHub Profile
@jpwilliams
jpwilliams / main.go
Created November 23, 2023 12:27
Example Golang timezones from `tzdata`
package main
import (
"fmt"
"io/ioutil"
"strings"
"unicode"
)
func main() {
@jpwilliams
jpwilliams / _usage.ts
Created October 7, 2022 15:47
Prettier error handling
import { sayHello } from "./sayHello.ts";
const [str, isErr, err] = await sayHello();
@jpwilliams
jpwilliams / README_secure_gpg_transfer.md
Last active July 6, 2022 14:35
Securely transferring files with GPG keys

Secure data transfer using GPG keys

Sometimes you need a secure way to pass a file from one place to another, ensuring that only the intended recipient can read its contents. We can achieve this simply using GPG keys.

The flow is:

  1. Recipient generates a GPG key
  2. Recipient exports a public key
  3. Recipient sends public key to sender
  4. Sender receives public key from recipient
@jpwilliams
jpwilliams / README.md
Created August 10, 2021 11:25
WSL 2 TPC Network Forwarding

Pulled from microsoft/WSL#4150 - microsoft/WSL#4150 (comment).

WSL 2 TPC NETWORK FORWARDING

Introduction

With the introduction of WSL 2 Beta, Microsoft has made changes to the system architecture. The changes include changing from the default bridged network adapter to a hyper-v virtual network adapter. The implementation was not completed during the launch of the beta program. This makes accessing of network resources under WSL 2 complex. The work around is to forward the TCP ports of WSL 2 services to the host OS. The virtual adapter on WSL 2 machine changes it's ip address during reboot which makes it tough to implement a run once solution.

@jpwilliams
jpwilliams / blog.md
Last active July 20, 2020 21:27
📘 Notebook

📌 Fetching the latest release of a GitHub package with Cloudflare Workers 📌 Nullish Short-Circuit Assignment in TypeScript 4.0 (beta) 📌 How to unpack the return type of a Promise in TypeScript

@jpwilliams
jpwilliams / README.md
Created February 10, 2020 09:43
Using CMD/OPT+Arrow keys in iTerm
  • ⌘→ Move to end of line.
  • ⌘← Move to beginning of line
  • ⌥→ Move to beginning of next word
  • ⌥← Move to beginning of previous word

This is normal for Mac text processing, but not default in Terminal or iTerm2.

I haven't looked at how to enable this for Terminal, but for iTerm2:

  1. Open iTerm Preferences (⌘,)
@jpwilliams
jpwilliams / great-things.txt
Created January 20, 2020 10:35
⚡️ Great things
😳 I did not realise you could pin a gist

Keybase proof

I hereby claim:

  • I am jpwilliams on github.
  • I am jackwilliams (https://keybase.io/jackwilliams) on keybase.
  • I have a public key ASDLDgiqJQJt1S4SsABrTECWr8uS4-OsUCye07HXQk9Ljwo

To claim this, I am signing this object:

@jpwilliams
jpwilliams / index.js
Created June 5, 2018 19:23
Jaeger FOLLOWS_FROM Issue
const opentracing = require('opentracing')
const { initTracer } = require('jaeger-client')
const tracer = initTracer({
serviceName: 'test',
reporter: {
logSpans: true,
flushIntervalMs: 10
}
})
@jpwilliams
jpwilliams / _locker.md
Last active April 25, 2018 12:27
A promise-based locking mechanism.

Usage

// create a new lock
const locker = new Locker()

// wait for lock
const releaseLock = await locker.waitForLock()

// we have the lock! do stuff