Skip to content

Instantly share code, notes, and snippets.

View katychuang's full-sized avatar

Dr. Kat katychuang

View GitHub Profile
@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
}
public class Circle {
private double radius;
public Circle(double radius) {
this.radius = radius;
}
public double getRadius() {
return radius;
@katychuang
katychuang / Install-Nix.md
Last active August 29, 2015 14:14
nix installation on OSX 10.10 with ghc 7.8 and Cabal-1.22

To install nix on OSX10.10, I first followed this [nixos.org wiki guide][1] shared by @boothead, and then found [this guide][3] on setting up a haskell environment with nix. See config.nix file below. I made one change from the tutorial, which is to change ghc783 to ghc784 (line 13).

After creating the file ~/.nixpkgs/config.nix, I skipped the ghc76 stuff and went straight to nix-env -i env-ghc78. It took a bit more than 2 hrs on an 8gb ram MBA for everything to build and link. The end result says

building path(s) ‘/nix/store/6rcj8chl2vim4mry5k7w8gs7nxifxixc-user-environment’
created 51 symlinks in user environment

Then finally: load-env-ghc78 loaded up a shell from which I could ghci