Skip to content

Instantly share code, notes, and snippets.

View paulovittor23's full-sized avatar

Paulo Vitor Rendeiro paulovittor23

View GitHub Profile
@paulovittor23
paulovittor23 / gist:2819926
Created May 28, 2012 16:16
Extend "vagrant ssh" to allow X, agent forwarding
# add to Vagrantfile config
config.ssh.forward_x11 = true
@paulovittor23
paulovittor23 / gist:2871137
Created June 4, 2012 22:14
how to convert vmdk to vhd
VBoxManage clonehd /Users/paulo/VirtualBox\ VMs/devtools_1338568497/box-disk1.vmdk --format VHD ~/Desktop/cururu.vhd
How to install Statsd + Graphite on Centos 5.X
https://gist.github.com/889297
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
@paulovittor23
paulovittor23 / dbus-uuidgen
Created August 30, 2012 13:56
dbus error on firefox initialization
dbus-uuidgen
@paulovittor23
paulovittor23 / jenkins_plugins_to_test.txt
Created September 14, 2012 19:45
jenkins_plugins_to_test
Plugin
@paulovittor23
paulovittor23 / memcached_session_store.rb
Created October 29, 2012 16:53
memcached session store
# Memcached config
memcache_config = YAML.load_file("#{RAILS_ROOT}/config/memcached.yml")[RAILS_ENV]
if memcache_config.nil?
raise ArgumentError.new("[ environment.rb ] Memcached configurations could not be found for RAILS_ENV => #{RAILS_ENV}")
end
require 'memcache'
CACHE = MemCache.new(:namespace => "abril-id-#{RAILS_ENV}")
CACHE.servers = memcache_config['servers']
@paulovittor23
paulovittor23 / memcached.yml
Created October 29, 2012 16:56
mecached_yml
# base config
base_cache: &base_cache
expires: 86400 #session expired after 24 hours
servers:
- '127.0.0.1:11211'
cucumber:
<<: *base_cache
# local
@paulovittor23
paulovittor23 / memvalues
Created October 29, 2012 17:40
memcached_values
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "172.16.10.196", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end
cluster.name: logs
# Puppet-ism to put in the hostname and IP
node.name: <%= @hostname %>
network.host: <%= @ipaddress %>
# Turn off multicast autodiscovery
discovery.zen.ping.unicast.hosts: 172.1.1.100:9300, 172.1.1.101:9300
index.number_of_shards: 4
index.routing.allocation.total_shards_per_node: 1
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29
//
// db.collection.update( criteria, objNew, upsert, multi )
// criteria - query which selects the record to update;
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it
// multi - if all documents matching criteria should be updated
//
// SQL VERSION:
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue'