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 / form.js
Created July 15, 2021 23:22
How forms are handled on the server-side
#!/usr/bin/env node
const http = require('http')
const url = require('url')
const qs = require('querystring')
function formHandler (request, response) {
response.write(`method: ${request.method}\n`)
response.write(`url: ${request.url}\n`)
@ProfAvery
ProfAvery / hash.py
Created June 25, 2021 05:25
Fun with hash tables
students = [
['foo', 'junior'],
['bar', 'senior'],
['baz', 'junior'],
['quux', 'junior'],
['guacamole', 'senior'],
['spatula', 'junior'],
['firewood', 'senior'],
]
@ProfAvery
ProfAvery / Makefile
Created January 7, 2021 05:23
State machine example in C
CFLAGS= -g -std=c11 -Wall -Wextra -Wpedantic
TARGET=dieroll
$(TARGET): $(TARGET).c
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
test: $(TARGET)
./$< 100000
clean:
@ProfAvery
ProfAvery / .gitignore
Last active February 12, 2021 22:34
In-class exercise: Resource Allocation Graph
*.o
resource-allocation
@ProfAvery
ProfAvery / .gitignore
Last active October 8, 2020 09:04
POSIX Multithreading Example
burncpu
multithread
mutex
semaphore
@ProfAvery
ProfAvery / onethread.cpp
Created September 22, 2020 23:24
C++ variant of Figure 4.11
#include <cstdlib>
#include <iostream>
#include <pthread.h>
using std::cout;
using std::cerr;
using std::endl;
// Don't forget to compile with -pthread
@ProfAvery
ProfAvery / .gitignore
Last active October 12, 2020 01:03
POSIX Shared Memory Example
*.o
send_string
receive_string
@ProfAvery
ProfAvery / forking.cpp
Created September 16, 2020 06:55
C++ variant of Figure 3.8
#include <cstdlib>
#include <iostream>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
using std::cout;
using std::cerr;
using std::endl;
@ProfAvery
ProfAvery / grandparent.cpp
Created September 16, 2020 06:51
In-class Exercise: Parent and Child Processes
#include <cstdlib>
#include <iostream>
#include <sys/wait.h>
#include <unistd.h>
using std::cout;
using std::endl;
int main()
@ProfAvery
ProfAvery / Basic Linear Regression.ipynb
Created September 11, 2020 16:08
Linear Regression with scikit-learn on the Olympic men's 100m dataset
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.