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 / 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);
}
@ProfAvery
ProfAvery / hello-c.ex_
Last active October 8, 2024 17:55
CPSC 458 - Harmless .exe files for basic static analysis
@ProfAvery
ProfAvery / even-ones-3.cnf
Last active October 8, 2024 17:56
California State University, Fullerton - CPSC 439 - Theory of Computation
p cnf 11 22
c DIMACS version of
c https://github.com/sahands/simple-sat/blob/master/src/tests/fsm/even-ones-3.in
c No more than one state at each step
-1 -2 0
-3 -4 0
-5 -6 0
-7 -8 0
@ProfAvery
ProfAvery / Makefile
Created March 11, 2022 04:51
CPSC 439 - Spring 2022 - Week 6 - List-of-tuples Representation
CXXFLAGS = -g -std=c++17 -Wall -Wextra -Wpedantic -Werror
.PHONY: clean
run: test
./test
test: test.cpp nand-circ.h
$(CXX) $(CXXFLAGS) $< -o $@
@ProfAvery
ProfAvery / desugar.cpp
Last active October 8, 2024 17:56
CPSC 439 - Spring 2022 - Week 5 - NAND-CIRC-IF
#include <iostream>
/*
C++ version of
https://nbviewer.org/github/boazbk/tcscode/blob/master/Chap_04_Syntactic_Sugar.ipynb#Even-more-sugar
*/
using std::cout;
using std::endl;
using std::string;
@ProfAvery
ProfAvery / Makefile
Created December 8, 2021 05:30
C++ variants of Figures 29.1, 29.2, and 29.4
CXXFLAGS = -g -std=c++17 -Wall -Wextra -Wpedantic -Werror -pthread #-fsanitize=thread
SRCS = no-lock-no-threads.cpp \
lock-no-threads.cpp \
single-lock-threaded.cpp \
multiple-lock-threaded.cpp \
approximate.cpp
TARGETS = $(SRCS:.cpp=)
.PHONY: clean