brew install tmux
Run tmux -CC or tmux -CC attach in iTerm2 and then menu is shown on terminal:
- ESC to detach
- C to run commands
- X to force quit
- L for log
brew install tmux
Run tmux -CC or tmux -CC attach in iTerm2 and then menu is shown on terminal:
| // clang -o smc smc.c -framework IOKit -framework CoreFoundation | |
| /* | |
| * Apple System Management Control (SMC) Tool | |
| * Copyright (C) 2006 devnull | |
| * | |
| * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License | |
| * as published by the Free Software Foundation; either version 2 | |
| * of the License, or (at your option) any later version. |
| #! /bin/bash | |
| wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz | |
| tar xzf protobuf-2.6.1.tar.gz | |
| cd protobuf-2.6.1 | |
| sudo apt-get update | |
| sudo apt-get install build-essential | |
| sudo ./configure | |
| sudo make | |
| sudo make check | |
| sudo make install |
| // Numerical matrix examples | |
| let x: Matrix = [[10, 9, 8], [3, 2, 1]] | |
| let y: Matrix = [[1, 2, 3], [4, 5, 6]] | |
| let z: Matrix = [[1, 2], [3, 4], [5, 6]] | |
| x + y // [[11, 11, 11], [7, 7, 7]] | |
| x * y // [[10, 18, 24], [12, 10, 6]] | |
| 2 * x // [[20, 18, 16], [6, 4, 2]] | |
| y ** z // [[22, 28], [49, 64]] |
| launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist | |
| sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist | |
| sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz | |
| sudo pkgutil --forget org.macosforge.xquartz.pkg | |
| # Log out and log in |
| #!/bin/bash | |
| # source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html | |
| sudo rm -rf /Library/Frameworks/GHC.framework | |
| sudo rm -rf /Library/Frameworks/HaskellPlatform.framework | |
| sudo rm -rf /Library/Haskell | |
| rm -rf ~/.cabal | |
| rm -rf ~/.ghc | |
| rm -rf ~/Library/Haskell |
| 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 |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)