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
| #!/bin/bash | |
| #------------------------------------------------------------------------------ | |
| # Name: sbtmkdirs | |
| # Version: 1.5 | |
| # Purpose: Create an SBT project directory structure with a few simple options. | |
| # Author: Alvin Alexander, http://alvinalexander.com | |
| # License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
| # http://creativecommons.org/licenses/by-sa/2.5/ | |
| #------------------------------------------------------------------------------ |
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
| import scala.runtime.ScalaRunTime | |
| /** | |
| * A sample code to implement a customized case class manually (for Scala 2.9.2 final). | |
| * | |
| * Id has two properties: name and displayName. 'displayName' has default value that | |
| * is same value as 'name'. | |
| */ | |
| class Id private ( // make primary constructor not to be accessible. (standard case class can do) |
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
| # SNAKES GAME | |
| # Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting | |
| import curses | |
| from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN | |
| from random import randint | |
| curses.initscr() | |
| win = curses.newwin(20, 60, 0, 0) |
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
| #!/bin/sh | |
| policy=${HOME}/.jstatd.all.policy | |
| [ -r ${policy} ] || cat >${policy} <<'POLICY' | |
| grant codebase "file:${java.home}/../lib/tools.jar" { | |
| permission java.security.AllPermission; | |
| }; | |
| POLICY | |
| jstatd -J-Djava.security.policy=${policy} & |
NewerOlder