Skip to content

Instantly share code, notes, and snippets.

View justinledwards's full-sized avatar

Justin Edwards justinledwards

  • Florida Ninth Circuit Courts
  • Florida
View GitHub Profile
@justinledwards
justinledwards / App.svelte
Created September 15, 2024 23:25
prime fireworks
<script>
import { writable } from 'svelte/store';
import { onMount } from 'svelte';
// Declare reactive stores
const primesStore = writable([]);
const progressStore = writable(0);
const timeStore = writable(0);
let isRunning = false;
@justinledwards
justinledwards / missingApple.txt
Created May 3, 2024 17:22
Phi-3-128k chat about apples
User, [5/3/24 1:17 PM]
Create 10 sentences that ends with the word "apple". Remember the word "apple" MUST be at the end.
AI, [5/3/24 1:17 PM]
1. After a long day of work, I enjoy a refreshing glass of apple juice.
2. The story of Snow White and her poisoned apple is a classic tale known worldwide.
3. In the garden, the red and green apples hang from the branches, ripe and juicy.
@justinledwards
justinledwards / ai-summary-choice.py
Created April 25, 2024 20:31
Auto choosing chunked ai summary bot
import os
import subprocess
from bs4 import BeautifulSoup
from nltk.tokenize import sent_tokenize, word_tokenize
from playwright.sync_api import sync_playwright
MAX_CONTEXT_SIZE = 8000
OVERLAP_TOKENS = 100
def fetch_html(url):
@justinledwards
justinledwards / game.rb
Last active November 23, 2023 15:15
ruby 2d tic tac toe
# frozen_string_literal: true
require 'ruby2d'
# This class represents the game board.
class Board
attr_accessor :cells
def initialize
@cells = Array.new(3) { Array.new(3, '') }
@justinledwards
justinledwards / chat-gpt-code-fail.md
Created November 19, 2023 17:43
Seeing if chatgpt can figure out how to solve tests.
class RacingGame:
    def __init__(self, width, height, road_width):
        self.width = width
        self.height = height
        self.road_width = road_width
        self.car_position = width // 2 + 1  # Adjusted to stay on the right
        self.road_offset = 0
        self.road_direction = 1
        self.game_over = False
@justinledwards
justinledwards / junos_recommend.py
Created November 5, 2023 20:55
Get Recommended Junos Versions
from playwright.sync_api import sync_playwright
from bs4 import BeautifulSoup
def extract_data(page_content):
soup = BeautifulSoup(page_content, 'html.parser')
series_list = ["EX Series Ethernet Switches", "ACX Series Service Routers",
"J Series Service Routers", "QFX Series Service Routers",
"SRX Series Services Gateways"]
for series in series_list:
@justinledwards
justinledwards / Cargo.toml
Last active November 2, 2023 21:26
i love lamp
[package]
name = "rust-lavalamp"
version = "0.1.0"
edition = "2018"
# Dependencies
[dependencies]
rand = "0.8"
ncurses = "5.101.0"
@justinledwards
justinledwards / snakecheat.js
Created September 13, 2023 12:43
Snake cheat
let e=e=>new Promise(t=>setTimeout(t,e)),c=e=>e.charCodeAt(),a=e=>"Arrow"+e,k=e=>{let t=new KeyboardEvent("keydown",{key:e,code:e,keyCode:c(e),which:c(e)});document.dispatchEvent(t)},t=(t,o)=>e(t).then(()=>k(a(o))),l=async()=>{for(let e=0;e<1e9;e++)await t(30,"Left"),await t(720,"Up"),await t(30,"Right"),await t(780,"Up")};e(90).then(l);

On-Page JavaScript Console.

ChatGPT:

Creating a simple on-page JavaScript console or REPL can be achieved with a combination of HTML, CSS, and JavaScript. You can use localStorage to maintain state between sessions. Here's a basic implementation that you can use as a starting point and modify to fit your needs:

  1. First, create the HTML structure for your on-page console:
<!DOCTYPE html>
<html lang="en">
@justinledwards
justinledwards / Cargo.toml
Created May 2, 2023 16:41
Rust Snake GUI
[package]
name = "snake"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
piston_window = "0.128.0"
rand = "0.8.5"