Skip to content

Instantly share code, notes, and snippets.

View eduardo's full-sized avatar

Edu Fernández eduardo

View GitHub Profile
def ver
alt = (self.tipo == "Lateral" ? self.altura_lateral : self.altura)
if self.formato == "Flash"
html="<a href=\"#{self.url_destino.pon_http}\" title=\"#{self.texto}\">"
html+=" <object class=\"#{self.tipo == 'Superior' ? 'banner-top' : 'hotelrecomendado'}\">"
html+=" <param name=\"movie\" value=\"#{self.url_imagen.pon_http}\">"
html+=" <embed src=\"#{self.url_imagen.pon_http}\" width=\"#{self.anchura}\" height=\"#{alt}\">"
html+=" </embed>"
html+=" </object>"
html+="</a>"
$ dig soa juan.gg
; <<>> DiG 9.4.2-P2 <<>> soa juan.gg
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31209
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;juan.gg. IN SOA
$ sudo chef-solo -j /tmp/dna.json -l debug
INFO: Starting Chef Solo Run
DEBUG: Loading plugin os
DEBUG: Loading plugin ruby
DEBUG: Loading plugin languages
DEBUG: Loading plugin kernel
DEBUG: ---- Begin uname -s STDOUT ----
DEBUG: Linux
DEBUG: ---- End uname -s STDOUT ----
DEBUG: Ran (uname -s) returned 0
@eduardo
eduardo / httpdump
Created April 4, 2009 10:55 — forked from peterc/httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*""
# All the above tested only on OS X.
# urlmonitor - print out the URLs requested system wide on the main network interface
# Accept a network interface name as an optional argument
iface = ARGV.first
# No interface specified? Try to guess which one is king..
unless iface
`ifconfig -l`.split.each do |iface|
next if iface =~ /^lo/
break if `ifconfig #{iface}` =~ /inet (0|1|2)/
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
@eduardo
eduardo / gist:106431
Created May 4, 2009 11:29 — forked from ezmobius/gist:105680
Deploy recipe for chef
# JSON
{
"applications": [
{
"foobar": {
"migration_command": "rake db:migrate",
"branch": "HEAD",
"deploy_action": "deploy",
"framework_env": "production",
require 'rubygems'
require 'couchrest'
SERVER = CouchRest.new
DB = SERVER.database!('contact-manager')
class Contact < CouchRest::ExtendedDocument
use_database DB
property :first_name
require 'prawn'
require 'prawn/layout'
Prawn::Document.generate("table-test2.pdf") do
headers = ["Course", "Grade", "Comments"]
data = []
10.times { |i| data << ["Home Room", "A+", "Great work!"]}
def make_table(headers, data)
table(
class GitosisCofigGenerator
def initialize
@config = {}
end
def add_group(name, options = {})
@config.store(name, {:writable => options[:writable], :readonly => options[:readonly], :members => options[:members]})
end