- A secretbyte you want to read is stored at inaccessible memory locationpriv_mem.
- The sender triggers an access exception by attempting to read priv_mem.
- Due to CPU optimization (out-of-order execution), the load of secretfrompriv_memand the use of its value in (4) and (5) below may execute before the exception is triggered.
- Calculate an offsetinto a known arrayprobeby multiplyingsecretby the width of a cache line (or whatever block size the CPU typically fetches, like a 4096-byte page). This guarantees each of those 256 possible offsets will cache separately.
- Load probe[offset], which causes the CPU to cache exactly one chunk of of our array, populating one cache line.
- The exception finally triggers, clearing the modified registers...but cached data is not excised.
- Iterate over all 256 offsets into probeto find out which one loads fast. You've determined the value ofsecret.
  
    
      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
    
  
  
    
  | # use ImageMagick convert | |
| # the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf | |
| convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf | 
  
    
      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
    
  
  
    
  | apply plugin: 'java' | |
| sourceSets.main.java.srcDir('.') | |
| sourceSets.main.output.classesDir('bin') | |
| repositories { mavenCentral(); } | |
| def java(String x) { | |
| def arguments = x.split(" ") | |
| def t = arguments.tail() as List | 
N.B. This is now a library, thanks to the efforts of the wonderful @mtnygard. And the README does a good job of making clear just how terrible an idea it is to actually do this. :)
As any Clojurist knows, the REPL is an incredibly handy development tool. It can also be useful as a tool for debugging running programs. Of course, this raises the question of how to limit access to the REPL to authorized parties. With the Apache SSHD library, you can embed an SSH server in any JVM process. It takes only a little code to hook this up to a REPL, and to limit access either by public key or
  
    
      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
    
  
  
    
  | (ns turel.core | |
| (:refer-clojure :exclude [==]) | |
| (:use clojure.core.logic)) | |
| (defn not-membero | |
| [x l] | |
| (conde [(emptyo l)] | |
| [(fresh [head tail] | |
| (conso head tail l) | |
| (!= head x) | 
  
    
      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
    
  
  
    
  | Check out README.md to get started editing Clojure with Emacs. | 
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
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs