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 double getMedian(List<? extends Number> values) { | |
if(values.size() % 2 != 0) { | |
return values.get(values.size()/2).doubleValue(); | |
} else { | |
return (values.get((values.size()/2) - 1).doubleValue() + values.get(values.size()/2).doubleValue())/2; | |
} | |
} |
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
.status-ul { | |
list-style: none; | |
padding:0; | |
margin:0; | |
font-size: 8px; | |
} | |
.status-item { | |
display:inline; | |
border-style: solid; |
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
#!/bin/bash | |
p4 change -o | grep '^\(Change\|Client\|User\|Description\)' | sed "s/Description:/Description:$1/" | p4 change -i | cut -d ' ' -f 2 |
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
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm | |
sudo yum install gcc python26-devel | |
sudo yum install python26-setuptools | |
sudo easy_install-2.6 pip | |
sudo easy_install-2.6 -U distribute |
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
def ts_weeks_ago(n): | |
""" | |
Gets the unix timestamp n weeks ago | |
""" | |
return time.time() - (n*7*24*60*60*1000) |
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 void open() { | |
new Thread() { | |
public void run() { | |
loadData((Schema)null, _file); | |
} | |
}.start(); | |
} | |
@Override | |
protected boolean processRecord(GenericRecord data) { |
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 math | |
def lpm(*args): | |
return sum([math.log(x) for x in args]) | |
lpm(0.1,0.2) |
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
Test Gist |
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
git branch --set-upstream branch_name upstream/branch_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
private <K,T> List<Map.Entry<K, T>> denormalizeMap(Map<K,List<T>> nestedListMap) { | |
List<Map.Entry<K, T>> denormalizedEntryList = new ArrayList<Map.Entry<K,T>>(); | |
for(Map.Entry<K, List<T>> entry:nestedListMap.entrySet()) { | |
for(T t:entry.getValue()) { | |
denormalizedEntryList.add(new AbstractMap.SimpleEntry<K,T>(entry.getKey(), t)); | |
} | |
} | |
return denormalizedEntryList; | |
} |
NewerOlder