Skip to content

Instantly share code, notes, and snippets.

View dfrankland's full-sized avatar
🏕️
Catching Pokemon

Dylan Frankland dfrankland

🏕️
Catching Pokemon
View GitHub Profile

Google Nest Wifi QR Code Generation

Create a QR Code for one that is destroyed, misplaced, or removed from Google Nest Wifi access points.

  1. Use the following template to generate the text value for the QR code:

    1V:E100$P:3$R:1$D:700101$S:______________$L:641666004ADA471E$W:F072EA4C4100$H:____.ybc$C:________$
                              ^ ID                                               ^ Wifi ID  ^ Setup Code
    
@dfrankland
dfrankland / checkered.css
Created August 25, 2016 21:30
CSS Checkered pattern that can be used on all modern browsers.
body {
background-image:
linear-gradient(45deg, #ccc 25%, transparent 25%),
linear-gradient(135deg, #ccc 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #ccc 75%),
linear-gradient(135deg, transparent 75%, #ccc 75%);
background-size:25px 25px; /* Must be a square */
background-position:0 0, 12.5px 0, 12.5px -12.5px, 0px 12.5px; /* Must be half of one side of the square */
}
@dfrankland
dfrankland / optional-properties-to-undefined.ts
Created March 25, 2024 04:55
Convert TypeScript optional properties to required with `undefined` unions
/*
* [Try on the TypeScript Playground](https://www.typescriptlang.org/play?#code/PTAEDkHkBUFEC5QBcAWBLAzsgngBwKagYoD2ArgDYAmoAdiUqAEaEDGJAtriRvlQDR0SdfH1AAzEgCdQaRkmEtQAQ1qzaSfFPHLW+AFBI8hALLKpAay2gAvKADeoKfmVUStCtlAB9b2+-0SN4KZKwo3hzmVlTeuFIkBFJGvohktGgAjmSEGNgcTCQUoAC+ANz6hsagAEr4WWjOANL42BhmlpC4SGjuyhQACvGJ3fgYADzQAHy2DvqgoCAQMAigAKq8oJGW1iysymQbAAYAtAD8h074HCQAbqOgh2lU+OJotHwXCiRzoADa-epQFZsCRxKBoCosP0ALpnVK0Z6vd40fAAD00CKw0H+0NAp3BONAAB9QO0rDJENiYeUyhUjAQavhcBRdPgyVpBgktCNxtBBAA1GZPF5vPjTOz2H7-QHA0HgyGgGGIdkyNEYqhYwn42Co1gUMjPCY4wQq6YkwWUnE08qVBmdbq9AZDbloUbQEirBEi5ETcWM5mslWc4au8a1epNFptKL2nq0PrBl2jX2TG30wjQUaMOyxx2JpKh92exGiqhjRwJB3xiinRAYJBSN4AcxKqZ+iwAeqcgA)
*/
// NOTE: this type should not be composed, no need for it to be an interface
type Marker = { readonly __do_not_touch_marked_property__: unique symbol };
type RequireKeysMarkOptionalProperties<T> = {
// NOTE: Use marker because `-?` removes `undefined` too
[P in keyof T as P]-?: undefined extends T[P] ? T[P] | Marker : T[P];
@dfrankland
dfrankland / how_to_use_wireshark_with_nodejs.md
Created May 28, 2020 05:06
How to use Wireshark with Node.js (especially with HTTPS / TLS / SSL)

How to use Wireshark with Node.js (especially with HTTPS / TLS / SSL)

It can be difficult to trace network traffic from a Node.js application. Typically, folks will just instrument some logging to check that everything is working as it is supposed to. Unfortunately, sometimes there are too many abstractions or possible race conditions to accurately get a good trace. To get the most objective possible trace of network traffic Wireshark can be used.

Wireshark is a network protocol analyzer that makes it extremely simple to capture and trace network activity from any source on your computer. It also has

@dfrankland
dfrankland / nix-derivation-outputs.sh
Created October 11, 2023 07:00
An example of getting all outputs of a nix derivation
#!/bin/bash
nix derivation show nixpkgs#zstd | jq 'to_entries[].value.outputs'
@dfrankland
dfrankland / steps-to-use-pritunl-on-a-server.md
Last active April 5, 2023 14:11
Steps to use Pritunl on a server or headless environment
@dfrankland
dfrankland / Building QMK firmware on Mac.md
Created October 4, 2022 01:18
Building QMK firmware on Mac

Building QMK firmware on Mac

Just edit the make command in utils/docker_build.sh and then run the utils/docker_build.sh file (you may still need to provide the keyboard:keymap:target though).

Example for faux fox v2

Edit the last line of utils/docker_build.sh:

@dfrankland
dfrankland / prisma-utils.ts
Created August 16, 2022 14:55 — forked from rsaryev/prisma-utils.ts
Prisma analogue migrate rest command only programmatically, for testing purposes.
import { Prisma, PrismaClient } from '@prisma/client';
import { exec } from 'child_process';
import * as util from 'util';
const execPromisify = util.promisify(exec);
const prisma = new PrismaClient();
const tables = Prisma.dmmf.datamodel.models
.map((model) => model.dbName)
.filter((table) => table);
@dfrankland
dfrankland / fish-diff-psub-example.fish
Created November 9, 2016 17:10
Fish shell redirect output of commands to another command
#! fish
# Taken from: http://assoc.tumblr.com/post/50764567605/named-pipes-in-fish-shell
# More on `psub` here: https://linux.die.net/man/1/psub
diff (sort a.txt|psub) (sort b.txt|psub)
@dfrankland
dfrankland / README
Created March 3, 2022 04:53 — forked from jmatsushita/README
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration
#
# Let's get started
#
# Let's install nix (at the time of writing this is version 2.5.1
curl -L https://nixos.org/nix/install | sh
# I might not have needed to, but I rebooted