Skip to content

Instantly share code, notes, and snippets.

@craigw
Created July 20, 2009 19:37
Show Gist options
  • Save craigw/150815 to your computer and use it in GitHub Desktop.
Save craigw/150815 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require 'socket'
socket = TCPSocket.open('localhost', '11211')
socket.send("stats\r\n", 0)
statistics = []
loop do
data = socket.recv(4096)
if !data || data.length == 0
break
end
statistics << data
if statistics.join.split(/\n/)[-1] =~ /END/
break
end
end
puts statistics.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment