This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Employee implements Comparable { | |
private String id; | |
private String name; | |
public Employee(String id, String name){ | |
setId(id); | |
setName(name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CircleTest2 { | |
public static class Circle_1 { | |
public float r = 100; | |
public float getR(){ return r;} | |
} | |
public static class GraphicCircle_1 extends Circle_1 { | |
public float r = 10; | |
public float getR(){ return r;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.Exception; | |
import java.util.Scanner; | |
import java.util.StringTokenizer; | |
public class DateParser { | |
public static void main(String[] args) throws Exception { | |
while (true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Monte Carlo simulation of the payoffs to angel investing. | |
# | |
# Assume a pool of N different investors, each investing in D deals, | |
# with a fixed time horizon and a fixed distribution of payoffs. | |
# Randomly simulate each investor's total payoff, then compute the | |
# mean and std dev of all IRRs in the overall pool. | |
# | |
# This gives an individual angel an idea of what kind of payoff & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl http://npmjs.org/install.sh | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Variation on Hashrocket's script for managing the git process | |
# as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html | |
# Create shell scripts out of each of these, put them in your path (~/bin for example) | |
# chmod 755 them and use like this: | |
# | |
# This version of hack is totally different than Hackrockets. I feel that hack implies | |
# that you are getting started, not finishing up. sink is Hashrockets hack. | |
# | |
# $ hack branch_name | |
# Test and Implement until done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# HTML Character Convertor | |
# Replaces HTML entities in a given string - with their correct character. | |
def extractKeyValueToDictionary(fileName): | |
allLines = open(fileName, 'r').readlines() | |
dictionary = {} | |
for line in allLines: | |
key,value=line.split(':') |