This file contains hidden or 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
export from google doc (csv) | |
tail -n +2 pingis_test #remove column headers | |
split -l5 pingis_test temp/ | |
for f in *; do awk 'BEGIN{FS=","} {print $1 " " $2 " " $3}' "$f" && echo "--------------"; done |
This file contains hidden or 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
Multimap<K, V> multimap = Multimaps.synchronizedMultimap(HashMultimap.<K, V>create()); | |
.. | |
synchronize(multimap) { | |
multimap.put(k, v); | |
} |
This file contains hidden or 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
Free internet in hotels etc. | |
1, arp -aln | |
2, pick a mac address ("Linklayer Address") (ignore macs for x.x.x.[1, 255]) | |
3, sudo ifconfig en0 ether <MAC_ADDRESS> | |
4, restart wifi |
This file contains hidden or 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
d = defaultdict(int); | |
c = Counter(); | |
print d[7], c[7], len(d), len(c) |
This file contains hidden or 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 Deferred<T> { | |
private boolean fired = false; | |
private Object consequence = null; | |
private final List<AsyncResult<T>> callbacks = Lists.newLinkedList(); | |
public void addCallbacks(AsyncResult<T> callback) { | |
callbacks.add(callback); |
This file contains hidden or 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
This goes into /System/Library/LaunchDaemons/com.nullvision.noatime.plist | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.nullvision.noatime</string> | |
<key>ProgramArguments</key> |
This file contains hidden or 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 DefaultHashMap<K, V> extends HashMap<K, V> { | |
private final Class<V> cls; | |
public DefaultHashMap(Class factory) { | |
this.cls = factory; | |
} | |
@Override | |
public V get(Object key) { |
This file contains hidden or 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 GetPoetry { | |
static class PoetryIOHandler implements IOHandler { | |
public void handleAccept(SelectionKey key) throws IOException { } | |
public void handleConnect(SelectionKey key) throws IOException { } | |
public void handleRead(SelectionKey key) throws IOException { | |
ByteBuffer bb = (ByteBuffer) key.attachment(); |
This file contains hidden or 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
#define BIG_ENDIAN 0 | |
#define LITTLE_ENDIAN 1 | |
int testByteOrder() { | |
short int word = 0x0001; | |
char *byte = (char *) &word; | |
return (byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN); | |
} |
This file contains hidden or 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
package org.apache.deft.example; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import org.deftserver.io.IOLoop; | |
import org.deftserver.web.Application; | |
import org.deftserver.web.AsyncCallback; |