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
Latency Comparison Numbers | |
-------------------------- | |
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 | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
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
filename=$1 | |
touch $filename | |
cat <<EOM > $filename | |
#!/usr/bin/env ruby | |
EOM | |
chmod +x $filename | |
nano +3 $filename |
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
… | |
editor = "iA Writer" # Editor to open markdown posts with | |
… | |
# usage rake mass_edit["category-name"] | |
desc "Edit all posts with the given category" | |
task :mass_edit, :category do |t, args| | |
args.with_defaults(:category => nil) | |
posts = Dir.glob("#{source_dir}/#{posts_dir}/*.*") | |
if :category.nil? | |
puts "No posts found with that category" |
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
exit_cmds = [ | |
"q", "x" | |
] | |
voice = ARGV[0] || "whisper" # Defaults to creeper voice | |
Thread.new do | |
loop do | |
sentence = gets.chomp |
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
#!/usr/bin/env bash | |
# | |
# 1. Install 'xdotool' - http://www.semicomplete.com/projects/xdotool/ | |
# sudo apt-get install xdotool | |
# 2. Open a screen session: | |
# screen -S mouse_wiggle | |
# 3. Exec this script | |
# 4. Background the session with Ctrl+A+D | |
# |
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
class Dice | |
def self.roll( dice = [ "1d6" ], rolls = 1 ) | |
output = "---\n" | |
rolls.times do |roll| | |
outcome = [] | |
dice.each do |die| | |
number_of_dice = die.split('d')[0].to_i | |
sides = die.split('d')[1].to_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
#!/bin/bash | |
user=`whoami` | |
server=`hostname` | |
path_to_repo_dir="/var/git/" | |
path_to_www_dir="/var/www/" | |
project_name=$1 | |
# Init Git repository |
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
def build_dictionary | |
# from http://stackoverflow.com/a/3480849/834459 | |
dictionary = {} | |
File.open("/usr/share/dict/words") do |file| | |
file.each do |line| | |
dictionary[line.strip] = true | |
end | |
end | |
return dictionary |
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
body { | |
background: none; | |
background-color: white; | |
font-family: Georgia, Times, serif; | |
} | |
div.post-outer { | |
background-color: #ffffff; | |
color: #000; | |
font-size: 16pt; |
NewerOlder