Skip to content

Instantly share code, notes, and snippets.

View dsturnbull's full-sized avatar

David Turnbull dsturnbull

View GitHub Profile
ARC Efficency:
Cache Access Total: 276254642
Cache Hit Ratio: 90% 251198888 [Defined State for buffer]
Cache Miss Ratio: 9% 25055754 [Undefined State for Buffer]
REAL Hit Ratio: 75% 208206774 [MRU/MFU Hits Only]
Data Demand Efficiency: 97%
Data Prefetch Efficiency: 44%
CACHE HITS BY CACHE LIST:
___ __ _
| _ \ __ _ ___ ___ ___ _ _ / _` | ___ _ _ ___
| _/ / _` | (_-< (_-< / -_) | ' \ \__, | / -_) | '_| (_-<
_|_|_ \__,_| /__/_ /__/_ \___| |_||_| |___/ \___| _|_|_ /__/_
_| """ |_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
[@dav] [@gdm ] [@julio ] [@puyo ] [@zin] ,mp
require 'uri'
class Fetcher
def fetch(url)
parts = URI.parse(url)
socket = TCPSocket.new(parts.host, parts.port)
socket << "GET / HTTP/1.0\r\n"
socket << "Host: #{parts.host}\r\n"
socket << "\r\n"
socket.read
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, options = {})
from_time = from_time.to_time if from_time.respond_to?(:to_time)
to_time = to_time.to_time if to_time.respond_to?(:to_time)
distance_in_minutes = (((to_time - from_time).abs)/60).round
distance_in_seconds = ((to_time - from_time).abs).round
I18n.with_options :locale => options[:locale], :scope => 'datetime.distance_in_words''datetime.distance_in_words' do |locale|
case distance_in_minutes
when 0..1
return distance_in_minutes == 0 ?
def (Rackjour::Proxy).const_missing(name)
proxy_class = Class.new do
def initialize(app)
p self.class
@app = app
end
end
(Rackjour::Proxy).const_set(name, proxy_class)
(Rackjour::Proxy).const_get(name)
end
(rdb:42) User.first == data[:user]
true
(rdb:42) Marshal.dump(User.first).is_a?(String)
true
(rdb:42) Marshal.dump(data[:user])
TypeError Exception: User can't be referred
also
(rdb:42) data[:user].attributes.map { |k, v| Marshal.dump(v) } #=> fine
# prepend "benched:" to your rake task name
# to generate pretty graphs of time taken
Rake.application.tasks.each do |t|
new_name = "benched:#{t.name}"
Rake::Task.define_task(new_name) do
begin
t1 = Time.now
t.invoke
ensure
" align commas nicely
" requires Align.vim http://www.vim.org/scripts/script.php?script_id=294
function! AlignCommasNicely()
exec ":AlignCtrl =Wl"
exec ":%Align ,"
exec ":%s/\\([ ]\\+\\),/,\\1/g"
endfunction
command! AC :call AlignCommasNicely()
Welcome to chat.
The session has been accepted.
{- Albert S.} Hello, David. Welcome to j2 Global online support. I am Albert, your online Live Support Representative. How may I assist you?
{David Turnbull} Albert, I would like to cancel my account.
{- Albert S.} We're sorry you want to cancel your account. Could you please provide me your fax number, registered email address and billing zip code for verification ?
{David Turnbull} 61-29-4754-839, [email protected], 2205
{David Turnbull} Is there a problem with that information?
{- Albert S.} David, I apologize for the inconvenience. In order to cancel your account, please contact our UK Customer Service Department at +44 (870) 711-2211 between the hours of 9:00 AM to 06:00 PM (GMT) Monday through Friday as they will be able to better assist you with your request, as I am based in US and do not have access to your billing information.
{- Albert S.} I mean to say our International Customer Support number +353 1 656 4910
{David Turnbull} My fax line is austra
IRQ Vect IPL Bus Trg Type CPU Share APIC/INT# ISR(s)
1 0x41 5 ISA Edg Fixed 0 1 0x0/0x1 i8042_intr
9 0x81 9 PCI Lvl Fixed 1 1 0x0/0x9 acpi_wrapper_isr
12 0x42 5 ISA Edg Fixed 1 1 0x0/0xc i8042_intr
14 0x40 5 ISA Edg Fixed 0 1 0x0/0xe ata_intr
16 0x83 9 PCI Lvl Fixed 0 1 0x0/0x10 ohci_intr
17 0x84 9 PCI Lvl Fixed 1 2 0x0/0x11 ohci_intr, ohci_intr
18 0x85 9 PCI Lvl Fixed 0 2 0x0/0x12 ohci_intr, ohci_intr
19 0x82 9 PCI Lvl Fixed 1 1 0x0/0x13 nv_intr_aif
22 0x43 5 PCI Lvl Fixed 1 1 0x0/0x16 ahci_intr