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 / 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.

@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 / regression-examples.ipynb
Last active October 25, 2024 00:12
CPSC 375 Examples - Linear Regression
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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>
@ProfAvery
ProfAvery / weather.snapshot.test.tsx
Created July 17, 2024 23:55
Updated Listing 8-26 - Summer 2024 AMSE Bootcamp
/**
* @jest-environment jsdom
*/
import { act, render, fireEvent } from "@testing-library/react";
import PageComponentWeather from "../../../pages/components/weather";
describe("PageComponentWeather", () => {
test("renders correctly", async () => {
let component: any;
@ProfAvery
ProfAvery / [zipcode].ts
Last active October 8, 2024 17:42
Updated Listing 7-9 - Summer 2024 AMSE Bootcamp
import type {NextApiRequest, NextApiResponse, NextApiHandler} from "next";
import {findByZip} from "./../../../../mongoose/weather/services";
import dbConnect from "./../../../../middleware/db-connect";
async function handler(
req: NextApiRequest,
res: NextApiResponse
): Promise<NextApiResponse<WeatherDetailType> | void> {
let data = await findByZip(req.query.zipcode as string);
return res.status(200).json(data);
@ProfAvery
ProfAvery / albums-graphql.mjs
Last active October 8, 2024 17:42
REST vs. GraphQL - Summer 2024 AMSE Bootcamp
const query = `
query {
artists(where: {name: "Red Hot Chili Peppers"}) {
albums {
title
}
}
}
`;