Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar

Chaz Reid charlesreid1

View GitHub Profile
echo "----------"
echo "running command 1..."
time for i in {0..1000}; do true; done
echo "----------"
echo "running command 2..."
time for i in {0..1000}; do echo "hello world" >> file; done
echo "----------"
echo "running command 3..."
# Sort by total time, in descending order
cat profiler_output_nqueens.csv | sort -n -r
# Sort by time per call (third column in file), in descending order
# -d "," means use "," as a field (column) delimiter
# -f 3,4 means grab fields (columns) 3 and 4
cat profiler_output_nqueens.csv | cut -d "," -f 3,4 | sort -n -r
public class EscapeHelloWorld {
public static void main(String[] args) {
System.out.println("A well-formed Java program has");
System.out.println("a main method with { and }");
System.out.println("braces.\n");
System.out.println("A system.out.println statement");
System.out.println("has ( and ) and usually a");
System.out.println("String that starts and ends");
System.out.println("with a \" character.");
public class Polynomial {
public Polynomial add(Polynomial p) {
int degp = p.coeffs.length;
int degthis = this.coeffs.length;
int mindegree = Math.min(degp, degthis);
int maxdegree = Math.max(degp, degthis);
public class SimpleTest {
public static void main(String[] args) {
System.out.println( (char)('a'+5) );
}
}
public class MinMaxAccount extends BankAccount {
private double minBalance;
private double maxBalance;
public MinMaxAccount(Startup s) {
super(s);
this.minBalance = getBalance();
this.maxBalance = getBalance();
import six
class Test(six.Iterator):
def __init__(self, init):
self.init = init
def __iter__(self):
return self
def __next__(self):
@charlesreid1
charlesreid1 / console_output
Last active May 6, 2017 11:57
Python 3: Numpy Array from Generator
$ python3 numpy_array_timing.py
Using TensorFlow backend.
Approach 1 took 43.884194135665894 s
Approach 2 took 43.12157201766968 s
$ python3 numpy_array_timing.py
Using TensorFlow backend.
Approach 1 took 44.887431383132935 s
Approach 2 took 49.045594930648804 s
@charlesreid1
charlesreid1 / .fuelrc
Created May 6, 2017 13:02
fuel + lfw_fuel configuration for Python 2 or Python 3 compatibility
data_path: "/Users/charles/fuel_data"
floatX : "float32"
@charlesreid1
charlesreid1 / Directory.java
Last active August 31, 2021 08:44
Recursion: Directory Crawl Example with Java
import java.io.*;
public class Directory {
private static void crawl(File f, int indent) {
// Always print the name of the File object, with appropriate indentation
for(int i=0; i<4*indent; i++) {
System.out.print(" ");
}
System.out.println(f.getName());