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 / rsa.py
Created October 7, 2025 15:18
Toy RSA implementation (Understanding Cryptography, Second Edition, pp. 206-208)
#!/usr/bin/env python3
import math, random
# RSA Key Generation, p. 208
p = int(input('p? '))
q = int(input('q? '))
n = p * q
phi = (p - 1) * (q - 1)
@ProfAvery
ProfAvery / compile.sh
Created October 3, 2025 22:49
Multi-arch MinGW build wrapper
#!/bin/sh
# compile.sh - multi-arch MinGW build wrapper
# Examples:
# ./compile.sh test.c
# ./compile.sh --64 test.c
# ./compile.sh --64 --dll mydll.c
# ./compile.sh --32 --windows test.c
# ./compile.sh --32 --windows --unicode test.c -- -D_DEBUG
set -eu
@ProfAvery
ProfAvery / Makefile
Created October 2, 2025 07:55
Example: Hello, DLL
all: main.exe hello.dll
main.exe: main.c
x86_64-w64-mingw32-gcc -o main.exe main.c
hello.dll: hello.c
x86_64-w64-mingw32-gcc -shared -o hello.dll hello.c
clean:
rm -f main.exe hello.dll
@ProfAvery
ProfAvery / cpsc449-exercise1.md
Created July 17, 2025 00:56
California State University, Fullerton - CPSC 449 - Web Back-End Engineering

CPSC 449 - Web Back-End Engineering

Exercise 1 - Fall 2023

This exercise may be completed individually, or in a pair with another student. If you work with another student, only one of you needs to submit via Canvas.

Exercise

By the end of this exercise you will have written Node.js programs to obtain information from REST and GraphQL APIs for an online music store.

/* global WebSocket */
const socket = new WebSocket('ws://localhost:8080')
// send message from the form
document.forms.publish.onsubmit = function () {
const outgoingMessage = this.message.value
socket.send(outgoingMessage)
return false
}
@ProfAvery
ProfAvery / waf.js
Created November 12, 2024 08:33
CPSC 455 - Filtering proxy / WAF PoC
#!/usr/bin/env node
// See https://chatgpt.com/share/67331281-9cec-800b-99fb-c193630dffa1
const http = require('http');
const { URL } = require('url');
const PORT = 8000;
const TARGET_PORT = 65412;
const TARGET_HOST = 'localhost';
@ProfAvery
ProfAvery / inheritance.js
Last active November 7, 2024 05:19
CPSC 455 - JavaScript prototypes, inheritance, and prototype pollution
// Prototype pollution, part 1
// See https://learning.oreilly.com/library/view/grokking-web-application/9781633438262/OEBPS/Text/11.html#heading_id_10
const food = {
munch() {
console.log('Eating')
},
}
const sandwich = {
@ProfAvery
ProfAvery / malware-analysis.wsb
Created September 17, 2024 21:17
CPSC 458 - Windows Sandbox configuration for Malware Analysis
<!-- Edit to taste, e.g. <HostFolder>s and <MemoryInMB> -->
<Configuration>
<vGpu>Disable</vGpu>
<Networking>Disable</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\Development\cpsc458\tools</HostFolder>
<SandboxFolder>C:\Users\WDAGUtilityAccount\Desktop\tools</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
@ProfAvery
ProfAvery / patch.py
Last active February 19, 2025 02:56
CPSC 375 - Monkey patch Lets-Plot to render graphs correctly as PDF
# This goes after the call to LetsPlot.setup_html(),
# but before calling ggplot().
def setup_svg():
def _repr_svg_(self):
from io import BytesIO
from sys import stdout
file_like = BytesIO()
self.to_svg(file_like)
return file_like.getvalue().decode(stdout.encoding)
@ProfAvery
ProfAvery / apateDNS.exe.config
Created September 10, 2024 03:45
CPSC 458 - ApateDNS config to avoid installing .NET 3.5
<configuration>
<startup>
<supportedRuntime version="v4.0" />
</startup>
</configuration>