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 HeadTest { | |
public static void main(String[] args) { | |
Observable<Integer> fileReader = Observable.create((Observable.OnSubscribe<Integer>) subscriber -> { | |
System.out.println("Reading from a file"); | |
subscriber.onNext(100); // header | |
for (int i = 0; i < 10; ++i) { | |
subscriber.onNext(i); | |
} |
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 HeadTest { | |
public static void main(String[] args) { | |
Observable<Integer> fileReader = Observable.create((Observable.OnSubscribe<Integer>) subscriber -> { | |
System.out.println("Reading from a file"); | |
subscriber.onNext(100); // header | |
for (int i = 0; i < 10; ++i) { | |
subscriber.onNext(i); | |
} |
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 Test { | |
private static void foo(String value, int...ints) { | |
System.out.println(value + " " + Arrays.asList(ints)); | |
} | |
private static void bar(String value, int...ints) { | |
foo(value, ints); | |
} | |
private static void baz(String value) { |
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/sh | |
# Cleanup docker files: untagged containers and images. | |
# | |
# Use `docker-cleanup -n` for a dry run to see what would be deleted. | |
untagged_containers() { | |
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1. | |
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6). | |
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470 | |
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}' |
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
=============== | |
Unity generated | |
=============== | |
Temp/ | |
Library/ | |
===================================== | |
Visual Studio / MonoDevelop generated | |
===================================== | |
ExportedObj/ |
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
#include <stdio.h> | |
#include <time.h> | |
typedef unsigned int uint32; | |
typedef long long int64; | |
template<typename F, typename V> | |
V collision_point(const F& f, V x) { | |
V slow = x; | |
V fast = f(x); |
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
// setup | |
int status = 0; | |
do { | |
// preconditions | |
status = doSomething(); | |
if (status) break; | |
status = doSomethingElse(); | |
if (status) break; |
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 static <K, T> Observable.Transformer<T, Pair<K, Observable<T>>> lazyGroupBy( | |
final Func1<? super T, ? extends K> keySelector) { | |
return new Observable.Transformer<T, Pair<K, Observable<T>>>() { | |
@Override | |
public Observable<Pair<K, Observable<T>>> call(Observable<T> observable) { | |
return Observable.create(s -> { | |
Map<K, Subscriber<? super T>> children = new HashMap<>(); | |
Multimap<K, T> buffer = ArrayListMultimap.create(); | |
Set<K> createdObservers = new HashSet<>(); |
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
PAYLOAD_TEMPLATE = \ | |
"""--==boundary\r | |
Content-Disposition: form-data; name="file"; filename="%s"\r | |
Content-Type: %s\r | |
\r | |
%s\r | |
--==boundary--\r | |
""" | |
destination_url = blobstore.create_upload_url('/upload-sink') |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns 3 µs | |
Send 2K bytes over 1 Gbps network 20,000 ns 20 µs | |
Read 1 MB sequentially from memory 250,000 ns 250 µs | |
Round trip within same datacenter 500,000 ns 0.5 ms | |
Disk seek 10,000,000 ns 10 ms |
OlderNewer