Skip to content

Instantly share code, notes, and snippets.

View jeremyckahn's full-sized avatar

Jeremy Kahn jeremyckahn

View GitHub Profile
// Generated by ChatGPT: https://chat.openai.com/share/6c78c3f4-213d-48e6-9f79-b85ef3a7adc7
// Helper functions for converting between ArrayBuffer and base64
function arrayBufferToBase64(buffer) {
const bytes = new Uint8Array(buffer);
return btoa(String.fromCharCode.apply(null, bytes));
}
function base64ToArrayBuffer(base64) {
const binaryString = atob(base64);
// Generated by ChatGPT: https://chat.openai.com/share/6c78c3f4-213d-48e6-9f79-b85ef3a7adc7
// Helper functions for converting between ArrayBuffer and base64
function arrayBufferToBase64(buffer) {
const bytes = new Uint8Array(buffer);
return btoa(String.fromCharCode.apply(null, bytes));
}
function base64ToArrayBuffer(base64) {
const binaryString = atob(base64);
// Written by ChatGPT: https://chat.openai.com/share/5a3241a3-d4ab-4d85-96c5-9aafdff8e483
// Function to generate a key pair
async function generateKeyPair() {
const keyPair = await crypto.subtle.generateKey(
{
name: 'RSA-OAEP',
modulusLength: 2048,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: 'SHA-256',
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"id": "6NTKCxHqlVnqYY7Mg_5ph",
"type": "text",
"x": 603,
"y": 639,
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"id": "eJf_ZiWYQLX4xuxjywCaG",
"type": "text",
"x": 345,
"y": 163.5,
@jeremyckahn
jeremyckahn / js-public-private-key-generation.js
Created December 4, 2023 03:13
Use Web Crypto API to create public and private key pairs and convert them to strings
// Generated by ChatGPT: https://chat.openai.com/share/eef660d9-eaf2-494e-8175-54290254c73f
// Function to generate a key pair
async function generateKeyPair() {
try {
const keyPair = await window.crypto.subtle.generateKey(
{
name: 'RSA-OAEP',
modulusLength: 2048,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),

Front End System Design Interview Checklist

  • Ask for clarifying questions
    • What is the scale of the solution needed?
      • How many daily active users?
      • How are they geographically distributed?
      • What are we expecting in terms of peak traffic?
    • What are the most business critical use-cases?
      • What's a user persona we should be targeting?
  • Identify constraints
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
{
"id": "6epLBtPWpajrmXVOPAgjr",
"type": "text",
"x": 102.5,
"y": -44,
// given a graph represented as a map of nodes and their children {node_1: [node_2, node_3]}, and two nodes a and b, write a function that returns a boolean indicating if node a is a descendant of node b
// isDescendant(graph, a, b) => returns true if a is a descendant of b
// Example
// g = {1: [2, 3], 2:[], 3:[4], 4:[5]}
// isDescendant(g, 5, 1) => true
// isDescendant(g, 2, 4) => false
// 1
@jeremyckahn
jeremyckahn / export_presets.cfg
Created January 17, 2022 23:18
export_presets.cfg for Farmhand Go!
[preset.0]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="./build/web/index.html"