Skip to content

Instantly share code, notes, and snippets.

View katychuang's full-sized avatar

Dr. Kat katychuang

View GitHub Profile
@katychuang
katychuang / _README
Last active October 24, 2024 17:54
SQLite
See makefile for execution
@katychuang
katychuang / api.js
Last active October 16, 2024 19:05
minimal example of API using expressjs. Demo: https://youtu.be/0Tj7u-8Iav0
const express = require("express");
const app = express();
const router = express.Router();
app.use(express.json());
const port = 3000;
// Start server
app.listen(port, () => {
console.log("Server running on port %PORT%".replace("%PORT%",port))
@katychuang
katychuang / awk_sort_by_col.awk
Last active April 1, 2022 15:25
This example sorts an input file by column using bubble sort to swap lines into the correct ascending order by a specified field.
# This program sorts input by a specified column
# Author: Katherine Chuang (@katychuang on Github)
# example awk -v column=2 -f prog.awk data.csv
#
# Program Steps:
# 1. Read input and store items in an array of array.
# 2. Sort by column specified (user input letter c)
# 3. Print the sorted version
BEGIN {
@katychuang
katychuang / README.md
Last active May 27, 2020 03:26
Awk script used for end of term reporting

This script and example were prepared to show how to use the awk program to split the BlackBoard download to multiple files. This assumes that you selected format of results = By Question and By User, such that each row represents a single question for a single student. See the csv file as an example.

Downloading from BlackBoard (separate row per question)

Go to Grade Center > Full Grade Center > Navigate to the Assignment or test's Column > Click on the down arrow next to the column's title > Select Download Results. Select 'By Question and User'. This gives you a file named Test.downloading.csv

Splitting into individual files

To run the awk program file you can try the following command.

@katychuang
katychuang / DoubleEndedLinkedList.java
Last active January 10, 2020 18:58
CISC 3130 Spring 2020 OER Code Snippets for https://libguides.brooklyn.cuny.edu/cisc3130/
/* Double-ended Linked List with Insert First, Insert Last */
class DoubleEndedLinkedList {
private Node first; // private link to the first element
private Node last;
// constructor sets first to null
public void DoubleEndedLinkedList(){
this.first = null;
this.last = null;
@katychuang
katychuang / SimpleLinkedList.java
Last active January 10, 2020 18:58
CISC 3130 Spring 2020 OER Code Snippets for https://libguides.brooklyn.cuny.edu/cisc3130/
/* Simple Linked List with Insert First */
class SimpleLinkedList {
private Node first; // private link to the first element
// constructor sets first to null
public void SimpleLinkedList(){
this.first = null;
}
public boolean isEmpty(){
@katychuang
katychuang / LinkedList.java
Last active January 10, 2020 14:56
CISC 3130 Spring 2020 OER Code Snippets for https://libguides.brooklyn.cuny.edu/cisc3130/
/* Linked List (empty), shows structure of classes and initial members */
class Node {
public int value;
public Node next;
// Constructor
public Node(int i) { /* blank for now */ }
// Method
@katychuang
katychuang / Arrays.java
Last active January 10, 2020 14:40
CISC 3130 Spring 2020 OER Code Snippets for https://libguides.brooklyn.cuny.edu/cisc3130/
double[] a; // 1. declare the array with a name
a = new double[n]; // 2. create the array
for (int i = 0; i < n; i++) // 3. elements are indexed from 0 to n-1
a[i] = 0.0; // initialize all elements to 0.0
@katychuang
katychuang / web-servers.md
Created January 1, 2020 04:13 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@katychuang
katychuang / SortTest.Java
Created November 13, 2019 12:14
Some Sorting Algorithm examples
class Sort {
private int[] a; // ref to array a
private int nElems; // number of data items
public Sort(int max) // constructor
{
a = new int[max]; // create the array
nElems = 0; // no items yet
}