Skip to content

Instantly share code, notes, and snippets.

View jeremyckahn's full-sized avatar

Jeremy Kahn jeremyckahn

View GitHub Profile
@jeremyckahn
jeremyckahn / gist:3cc4d6673ef65cacb69fc48aca6a8279
Created May 7, 2025 14:03
Prompt for bartowski:Qwen_Qwen3-30B-A3B-GGUF:Qwen_Qwen3-30B-A3B-Q4_0.gguf: Invert a binary tree in JS and print an ASCII representation of the before and after. /no_think
<think>
</think>
To invert a binary tree (also known as **mirroring** it), we swap each node's left and right children recursively.
Then, to **print an ASCII representation** of the tree before and after inversion, we can use a helper function that prints the tree in a structured way — typically using indentation and vertical lines to represent the hierarchy visually.
Here’s how you can do this in JavaScript:
@jeremyckahn
jeremyckahn / gist:2555dbf9730101b25d679777e8e36f8c
Created May 7, 2025 13:39
Prompt for unsloth:Qwen3-30B-A3B-GGUF:Qwen3-30B-A3B-UD-Q4_K_XL.gguf: Invert a binary tree in JS and print an ASCII representation of the before and after. /no_think
<think>
</think>
To **invert a binary tree** in JavaScript, you can perform a recursive swap of left and right children for each node.
Then, to **print an ASCII representation**, we'll use a helper function that prints the tree in a readable format (like how it might look on paper).
---

Here's a summary of the game rules based on the state machine:

  1. Initial State:

    • The game begins in an "UNINITIALIZED" state, waiting for each player to complete their setup.
    • A prompt is issued to the session owner to start setting up.
  2. Player Setup Phase:

    • Players are prompted to set up their initial state (PROMPT_PLAYER_FOR_SETUP).
    • Once all players have completed their setup (though this condition isn't explicitly checked in the code), the game moves to the "WAITING_FOR_PLAYER_TURN_ACTION" state, ready for player turns.
{
"allowCustomPeerCowNames": false,
"cellarInventory": [],
"completedAchievements": {},
"cowBreedingPen": {
"cowId1": null,
"cowId2": null,
"daysUntilBirth": -1
},
"cowColorsPurchased": {},
{
"allowCustomPeerCowNames": false,
"cellarInventory": [
{
"id": "84acbe21-60ad-4604-ab23-48240f0c970b",
"itemId": "wine-chardonnay",
"daysUntilMature": -151
},
{
"id": "e3a2afb9-fc25-4329-9d25-e290281f4ee5",
// 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,