Skip to content

Instantly share code, notes, and snippets.

View mv's full-sized avatar

Marcus Vinicius Ferreira mv

View GitHub Profile
@mv
mv / cr-amzn-ami-all.sh
Created December 31, 2011 20:07
All Amazon Linux versions, as of Dec/2011
ec2-create() {
echo "Creating ${1}${2}: $6"
ec2-run-instances --region ${1} -z ${1}${2} -g ${3} -k ${4} -t ${5} ${6} \
| tee -a $CREATED \
| gawk '{print strftime("%Y-%m-%d %H:%M:%S :", systime()), $0 }' >> $LOG
# echo "Sleeping...."
# sleep 45
}
@mv
mv / parse-json.rb
Created December 21, 2011 13:39 — forked from mislav/stupid-json.rb
Stupid simple JSON parser
require 'strscan'
require 'forwardable'
# Stupid JSON parser. Only handles well-formed JSON.
# Otherwise, it may go into an endless loop.
class Parser
WSP = /\s+/
OBJ = /[{\[]/
NUM = /-?\d+(\.\d+)?([eE][+-]?\d+)?/
BOL = /(?:true|false)\b/
@mv
mv / shared.rb
Created December 21, 2011 13:36 — forked from pbosetti/shared.rb
IPC shared memory access via FFI
#!/usr/bin/env ruby
# untitled.rb
# Created by Paolo Bosetti on 2011-04-22.
# Copyright (c) 2011 University of Trento. All rights reserved.
require "rubygems"
require 'ffi'
module Shared
@mv
mv / Vagrantfile
Created November 24, 2011 00:05
Vagrant configuration
##################################
### Custom additions from Krux
##################################
### Extensive documentation here:
### http://vagrantup.com/docs/vagrantfile.html
require 'etc'
owner = ENV['KRUX_MY_USERNAME'] || Etc.getlogin
hosts = {
@mv
mv / gist:1379148
Created November 19, 2011 18:10 — forked from jedi4ever/gist:1376525
Ganglia - Gmond packet listener in Ruby - Proof of Concept
require 'socket'
require 'pp'
require 'xdr'
# Inspiration
# https://github.com/fastly/ganglia/blob/master/lib/gm_protocol.x
# https://github.com/igrigorik/gmetric/blob/master/lib/gmetric.rb
# https://github.com/ganglia/monitor-core/blob/master/gmond/gmond.c#L1211
# https://github.com/ganglia/ganglia_contrib/blob/master/gmetric-python/gmetric.py#L107
Uppercase
gUw - upper word
gUU - upper line
guw - lower word
guu - lower line
gU3w - upper 3 words
GREAT
ga/g8 - display hex/utf8
ggg?G - rot13
gd - go to var local definition