Skip to content

Instantly share code, notes, and snippets.

View ProfAvery's full-sized avatar

Kenytt Avery ProfAvery

  • California State University, Fullerton
  • Fullerton, CA
View GitHub Profile
@ProfAvery
ProfAvery / createItems.mjs
Created July 1, 2024 22:43
PocketBase item population script - Summer 2024 AMSE Bootcamp
import PocketBase from 'pocketbase';
const pb = new PocketBase('http://127.0.0.1:8090');
const data = [
{
itemId: 'coffee',
imageId: 'coffee',
title: 'Coffee',
price: 0.99,
@ProfAvery
ProfAvery / latex-equation-cheat-sheet.ipynb
Created June 29, 2024 23:49
LaTeX Equation Cheat Sheet.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ProfAvery
ProfAvery / empirical_gradient.py
Last active October 8, 2024 17:43
California State University, Fullerton - CPSC 481 - Empirical gradient and gradient descent
#!/usr/bin/env python
def derivative(f, h=1e-5):
def df(x):
return (f(x + h) - f(x)) / h
return df
@ProfAvery
ProfAvery / mkclaims.py
Last active October 8, 2024 17:54
California State University, Fullerton - CPSC 449 - JWK and JWT generation
#!/usr/bin/env python
import os
import sys
import json
import datetime
def usage():
program = os.path.basename(sys.argv[0])
@ProfAvery
ProfAvery / zip.scm
Last active October 8, 2024 17:54
California State University, Fullerton - CPSC 439 - Exercise 8.10 in Scheme
(define PAIR cons)
(define HEAD car)
(define TAIL cdr)
(define ISEMPTY null?)
(define reverse
(lambda (l result)
(if (ISEMPTY l)
result
(reverse (TAIL l) (PAIR (HEAD l) result)))))
@ProfAvery
ProfAvery / disasm.sh
Created December 8, 2022 23:16
CPSC 458 - Disassemble arbitrary code from a hex dump
#!/bin/bash
set -euo pipefail
TMP_HEX=$(mktemp)
TMP_BIN=$(mktemp)
# Listing 19-1
cat > "$TMP_HEX" <<EOF
83 EC 20
31 D2
@ProfAvery
ProfAvery / spa.html
Created November 29, 2022 20:23
CPSC 349 - Multiple "pages" in a single HTML file.
<div id="page1">
<h1>First Page</h1>
<p>This page contains some text.</p>
</div>
<div id="page2" hidden>
<h1>Second Page</h1>
<p>This page contains a <a href="">link</a>.</p>
</div>
@ProfAvery
ProfAvery / app.jsx
Created November 28, 2022 22:06
CPSC 349 - Files for Fall 2022 Exercise 4
const USERNAME = 'ADMIN_EMAIL'
const PASSWORD = 'ADMIN_PASSWORD'
const pb = new PocketBase('http://127.0.0.1:8090')
const authData = await pb.admins.authWithPassword(USERNAME, PASSWORD)
console.log(authData)
const root = ReactDOM.createRoot(document.getElementById('root'))
@ProfAvery
ProfAvery / keylogger.c
Last active October 8, 2024 17:55
CPSC 458 - Key logger using GetAsyncKeyState()
#include <stdio.h>
#include <stdbool.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winuser.h>
#pragma comment(lib, "user32.lib")
int main()
@ProfAvery
ProfAvery / create-dot-remake.js
Created November 1, 2022 06:03
CPSC 349 - Create .remake file
#!/usr/bin/env node
module.paths.push('./_remake')
const nanoidGenerate = require('nanoid/generate')
const dotRemake = require('utils/dot-remake')
dotRemake.writeDotRemake({
port: 3000,
sessionSecret: nanoidGenerate('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 30)