Skip to content

Instantly share code, notes, and snippets.

View stevenpetryk's full-sized avatar

Steven Petryk stevenpetryk

View GitHub Profile
if ARGV[0]
tle = File.open(ARGV[0]).read
tle_line_1 = tle.lines[0]
tle_line_2 = tle.lines[1]
else
print 'Line 1 > '
tle_line_1 = gets.chomp
print 'Line 2 > '
tle_line_2 = gets.chomp
end
var gulp = require('gulp');
var sequence = require('run-sequence');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber')
var stylus = require('gulp-stylus');
var nib = require('nib');
var jeet = require('jeet');
var browserify = require('browserify');

COP 3503 Review

Hash tables

Linear (and quadratic) put and get

public class LinearHashTable {
  void put(DataStruct ds) {
    // For the test, we don't have to worry about table expansion.
    int hv = getHashValue(ds.getKey());
@stevenpetryk
stevenpetryk / d3.html
Last active September 9, 2015 02:36 — forked from LevelbossMike/d3.html
creating table from array of json with d3
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<table id="split">
<thead></thead>
<tbody></tbody>
MAX_RUNS = 100
MAX_STATES = 500
MAX_ALPHABET_SIZE = 10
def get_random_dfa
lines = []
states = (0..(1 + rand(MAX_STATES - 1))).to_a
alphabet_size = 1 + rand([MAX_ALPHABET_SIZE, states.count].min - 1)
accept_states = states.sample(1 + rand(states.count - 1))
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Steven Petryk</title>
</head>
<body>
<div>
<h1>Steven Petryk</h1>

Labels and branches in MIPS

In MIPS, there are only two types of instructions for controlling program flow, branches and jumps. As a MIPS program executes, the instructions are run sequentially from top to bottom and will only stop once they reach the end or encounter a branch or jump.

Labels

Labels allow us to assign a human-readable name to a particular place in code. Labels point to a specific line of code, they do not encapsulate code in any way from the code surrounding it. Take this example:

LOOP: slt $t0, $t1, $t2
ssh root@104.232.321.32 "tar cvf bundle.tar PATH-TO-APP"
scp root@104.232.321.32:bundle.tar .
import java.util.*;
public class monkey {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numCases = scanner.nextInt();
scanner.nextLine();
for (int i = 1; i <= numCases; i++) {
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.02b040b0a5e9b2ca5ffd4b410f8f21bb8a976820.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.2b163098f1bf531c159bceaa6a0a6a8cb3bc5874.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.2f35cb78c42dfa75aac8b066a53ee7a01837e8f8.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.3c9bb28f127459f217d5aa390dbe0fccc65b643b.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.3c6785c74db5ac2a9508a75781a1d46665bd72c8.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.5d5310774c2a9c7f06481d8c7c14495107673c8b.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.5fcd2f64bea83f1670773b0699d0b906165aca07.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.6d550937aa22378c7f2e96e6bb1920b17b237dc8.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.7d434b9fda0ef01b971a8bb1242b3289277ea61d.tar.gz
roseBinaryEDG-4-12-x86_64-pc-linux-gnu-gnu-4.9-4.7dc7c5dac37b9ffe2b4cb25183b42ac52fcea228.tar.gz