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 / 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)
@ProfAvery
ProfAvery / classes.js
Created October 31, 2022 20:54
CPSC 349 - Objects in JavaScript
#!/usr/bin/env node
class Dog {
constructor (name) {
this.name = name
}
speak () {
return `${this.name}: bark!`
}
@ProfAvery
ProfAvery / Makefile
Last active October 22, 2024 17:25
CPSC 458 - C++ Code from Chapter 20
# Note: to compile for 64-bit, open the "x64 Native Tools Command Prompt"
all: listing_20-1.obj listing_20-2.obj listing_20-4.obj listing_20-5.obj nonvirtual.obj virtual.obj
listing_20-1.obj: listing_20-1.cpp
cl /c listing_20-1.cpp
listing_20-2.obj: listing_20-2.cpp
cl /c listing_20-2.cpp
@ProfAvery
ProfAvery / Makefile
Last active October 22, 2024 17:37
CPSC 458 - C Code from Chapter 6
all: listing_6-01.exe listing_6-02.obj listing_6-06.obj listing_6-08.obj listing_6-10.obj listing_6-12.obj listing_6-14.obj listing_6-16.obj listing_6-18.obj listing_6-18.o listing_6-20.obj listing_6-22.obj listing_6-24.obj listing_6-26.obj listing_6-29.obj
listing_6-01.exe: listing_6-01.c
cl listing_6-01.c
listing_6-02.obj: listing_6-02.c
cl /c listing_6-02.c
listing_6-06.obj: listing_6-06.c
cl /c listing_6-06.c
@ProfAvery
ProfAvery / aslr
Last active October 8, 2024 17:40
CPSC 458 - ASLR and stack-protector demos
@ProfAvery
ProfAvery / hello.c
Last active October 8, 2024 17:55
CPSC 458 - 32-bit and 64-bit versions of hello.exe
#include <stdio.h>
#include <stdlib.h>
int main()
{
int c;
printf ("Hello.\n");
exit (0);
}