THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
class AddressBook | |
def contacts | |
@contacts ||= [] | |
end | |
def self.load_from_path(path) | |
# Create a new AddressBook instance | |
address_book = self.new | |
# Create a new AddressBookDSL instance |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
This code resolves the problem described in | |
http://xahlee.info/perl-python/python_construct_tree_from_edge.html | |
""" | |
import collections |
# MAC manipulators | |
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |
To test out the cache miss behavior of read operations, run a program building the index (30k entries) then another program building then reading the index (30k queries), and find their diff.
Here's how to generate the test script cmd.sh
3.times do |i|
%w[triez hash da].each do |ty|
puts "valgrind --tool=cachegrind --cachegrind-out-file=tmp/#{ty} ruby t.rb #{ty}"
puts "valgrind --tool=cachegrind --cachegrind-out-file=tmp/#{ty}.read ruby t.rb #{ty} read"
puts "cg_diff tmp/#{ty} tmp/#{ty}.read > tmp/#{ty}#{i}.diff"