Skip to content

Instantly share code, notes, and snippets.

View shaiguitar's full-sized avatar
💭
We can pickle that

Shai Rosenfeld shaiguitar

💭
We can pickle that
View GitHub Profile
/var/log/syslog.0:Mar 30 03:13:52 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 196496kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 03:27:05 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 195804kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 03:34:16 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 195364kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 03:46:29 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 194780kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 03:56:01 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 194836kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 04:04:04 ey06-s00022 monit[3759]: 'workling_gyminee' total mem amount of 194748kB matches resource limit [total mem amount>194560kB]
/var/log/syslog.0:Mar 30 04:14:44 ey06-s00022 monit[3759]: 'workling_g
shai@comp ~: $ eycheck red
Matched query string 'red'. Proceeding to search cloud platforms...
A double match was found (in pc and aws).
Did you mean private cloud or aws cloud? [ pc / aws ]
aws
More than one customer matched, which one do you want?
0) RedLine IT LLC
1) RedBubble Pty Ltd
## Running on 184.73.217.183 ( app_master )
[WARN] Process 'mongrel_adoptadogustine_5000' Execution failed - restart pending
[WARN] Found 1 monit restarts since (now May 16 03:44:52) at a rate of .266 restarts/hour. Latest was 3.7 hours ago.
## Running on ec2-174-129-66-49.compute-1.amazonaws.com ( db_master )
[WARN] 03:45:04 up 16 days, 14:13, 0 users, load average: 3.48, 3.46, 3.33
[WARN] Found 1 monit restarts since (now May 16 03:45:00) at a rate of .266 restarts/hour. Latest was 3.7 hours ago.
## Running on ec2-184-73-100-142.compute-1.amazonaws.com ( util )
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
require 'nokogiri'
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
class Hash
class << self
def from_xml(xml_io)
begin
result = Nokogiri::XML(xml_io)
return { result.root.name.to_sym => xml_node_to_hash(result.root)}
class MigrateMailAppRulesToGmailFilters
require 'pp'
# TODO HERE IS WHERE YOU REQUIRE plist lib.
# There's a good chance you can just "gem install plist"
# But I didn't get there, so I'm just showing you what I hacked up.
# Feel free to gem install and require of course.
Dir.chdir("/Users/shair/work/filters/plist/lib") # this is to require plist below.
require 'plist'
MAIL_API_KEYWORDS = %w(MarkRead CopyToMailboxURL)
@shaiguitar
shaiguitar / gist:943915
Created April 27, 2011 08:23
strace loop c
root@Ubuntu-1004-lucid-32-minimal ~ # cat c.c && make c && strace -- ./c
int main() {
for (;;) {
}
return 0;
}
make: `c' is up to date.
execve("./c", ["./c"], [/* 22 vars */]) = 0
## GOOD FOR /VERSIONS
## JSON, AND XML
shai@comp ~ » curl https://services.enterprisecloud.terremark.com/cloudapi/ecloud/versions/ -H 'x-tmrk-version: 2011-10-01' -H 'x-tmrk-date: Mon, 20 Feb 2012 23:02:22 GMT' -H 'Authorization: Basic bar' -H 'Accept: application/json'
[{"Version":"2011-07-01","Deprecated":false},{"Version":"2011-10-01","Deprecated":false}]%
shai@comp ~ » curl https://services.enterprisecloud.terremark.com/cloudapi/ecloud/versions/ -H 'x-tmrk-version: 2011-10-01' -H 'x-tmrk-date: Mon, 20 Feb 2012 23:02:22 GMT' -H 'Authorization: Basic bar' -H 'Accept: application/xml' | tidy -mi -xml
<SupportedVersions xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
@shaiguitar
shaiguitar / gist:3014696
Created June 28, 2012 23:26
realweb spec
1.9.2 realweb [silence_stdout]$ b rspec spec/
The Gemfile's dependencies are satisfied
...>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 127.0.0.1:8848, CTRL+C to stop
.>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 127.0.0.1:9669, CTRL+C to stop
.localhost - - [28/Jun/2012:16:25:37 PDT] "GET / HTTP/1.1" 500 338
- -> /
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "8"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsisas1068"
memsize = "1024"
mem.hotadd = "TRUE"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "Windows 7 x64.vmdk"
ide1:0.present = "TRUE"
@shaiguitar
shaiguitar / Readme.md
Created November 27, 2012 19:11
RubyApisAndClientsTalk

Testing HTTP APIs with Ruby

Good integration tests are hard. There are many approaches for testing server and client libraries all with various tradeoffs and problems that come up. Some are obvious, some are a little more tricky. I'll run through some approaches I've come across developing server APIs along with their corresponding clients, while developing these in a highly distributed systems setup at Engine Yard.

Shai Rosenfeld

Shai is always excited when there is something new to learn, and hence has seemed to have found his fit doing technology.

He started out playing with Ruby and Rails in 2006. After supporting and helping scale some of the largest Ruby production systems, he moved on to development of one of the leading Platform as a Services.