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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| 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 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
| ruby_block "sync_build_from_s3" do | |
| action :nothing | |
| block do | |
| # latest_file contains path to the latest.txt, which lists files to sync | |
| file = File.new(latest_file, "r"); | |
| run_context = Chef::RunContext.new(node, {}) | |
| # | |
| # Create the directory to hold the new build files | |
| # |
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 com.koushikdutta.nio; | |
| import java.nio.ByteBuffer; | |
| import java.nio.channels.ReadableByteChannel; | |
| import java.util.LinkedList; | |
| import junit.framework.Assert; | |
| public class ByteBufferList { | |
| private static final String LOGTAG = "Tether"; |
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
| import urlparse | |
| from urllib import urlretrieve | |
| base_url = 'http://ngm.nationalgeographic.com/' | |
| urls = [ \ | |
| "/u/H6yMi6fUB_1JR964xxG8RxsYArlNNn1lR5PWutchJ4t_YnYgRQSgSbjtWe2l0Iy-oLGsA9CsqdnrlLhmR0g3rCSzBRF7/", \ | |
| "/u/H6yMi6fUB_1JR964xxG8RxsYArlNNn1lR5PWutchJ4t_Y-BNZaUHGX3GhRGQkkys1pZ0r6MMH1tkBqLFL_pSFt3xA3Oi/", \ | |
| "/u/H6yMi6fUB_1JR964xxG8RxsYArlNNn1lR5PWutchJ4t6VV_HIvlh3DLvd9e4D4G0uBFWsZpxfwWu_TJ9TchpFQyt2qg8/", \ | |
| "/u/H6yMi6fUB_1JR964xxG8RxsYArlNNn1lR5PWutchJ4rkKJOkhh6J27Lg1KkOxF6sBxFqALR33By8KpJ5CndmMknK8Yyx/", \ |
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
| ctrl-z | |
| bg | |
| touch /tmp/stdout | |
| touch /tmp/stderr | |
| gdb -p $! | |
| # In GDB | |
| p dup2(open("/tmp/stdout", 1), 1) | |
| p dup2(open("/tmp/stderr", 1), 2) |
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
| // JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN. | |
| public final class ImprovedNoise { | |
| static public double noise(double x, double y, double z) { | |
| int X = (int)Math.floor(x) & 255, // FIND UNIT CUBE THAT | |
| Y = (int)Math.floor(y) & 255, // CONTAINS POINT. | |
| Z = (int)Math.floor(z) & 255; | |
| x -= Math.floor(x); // FIND RELATIVE X,Y,Z | |
| y -= Math.floor(y); // OF POINT IN CUBE. | |
| z -= Math.floor(z); |
NewerOlder