Skip to content

Instantly share code, notes, and snippets.

View csgregorian's full-sized avatar
🔥
git reset --hard

Christopher Gregorian csgregorian

🔥
git reset --hard
View GitHub Profile
{"speed": 50"}
# Author: Christopher Gregorian
# Website: csgregorian.com
# Name: Legend of Zelda: Link to the Present
# Completed: 03:18 AM, June 16th, 2014
# # # Imports # # #
# # Built-Ins # #
import sys
import os
def max_contiguous_subarray(array):
max_so_far = array[0]
max_at_ending = array[0]
for i in array:
max_at_ending = max(max_so_far + i, i)
max_so_far = max(max_at_ending, max_so_far)
return max_so_far
import java.util.*;
public class HashTable<T> {
private ArrayList<LinkedList<T>> table;
private int size, maxSize;
private double maxLoad;
public HashTable() {
// LinkedListTest.java
import java.util.*;
public class LinkedListTest {
public static void main(String[] args) {
LinkedList list = new LinkedList<Integer>(3);
list.print();
list.enqueue(4);
list.print();
function makeID(length) {
var text = '';
var possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
def sieve(n):
primes = []
sieve = [True] * (n + 1)
for p in range(2, n+1):
if sieve[p]:
primes.append(p)
for i in range(p ** 2, n + 1, p):
sieve[i] = False
### Keybase proof
I hereby claim:
* I am csgregorian on github.
* I am csg (https://keybase.io/csg) on keybase.
* I have a public key whose fingerprint is 5389 E696 FE01 731C 60AF 9669 C5A3 21A9 E252 61B2
To claim this, I am signing this object:
j() {
clear
echo "Compiling..."
javac $1.java
echo "Compiling complete! Running..."
java $1
echo "Running complete!"
}
jarcompile() {
jar cvfe $1.jar $1 *.class resources/*
echo -e "cd \$(dirname \$BASH_SOURCE)\njava -jar $1.jar\n" > $1.command
echo -e "java -jar $1.jar\n" > $1.bat
chmod +x $1.command
}