Skip to content

Instantly share code, notes, and snippets.

View rubiojr's full-sized avatar
🚀
>>>>>>>>> ⚠️ 💥 ☠️

Sergio Rubio rubiojr

🚀
>>>>>>>>> ⚠️ 💥 ☠️
View GitHub Profile
@rubiojr
rubiojr / openwrt_stats.rb
Created January 13, 2013 18:44
Getting OpenWRT router stats with ruby
require 'excon'
require 'pp'
require 'yajl'
# Auth parameters
username = 'root'
password = 'secret'
host = '192.168.1.1'
# Will parse returned JSON content
parser = Yajl::Parser.new

old arch

[9581][rubiojr.napoleon] ruby -rubygems g.rb 
      user     system      total        real
connection:      0.020000   0.010000   0.030000 (  7.400721)
create 10 images:  0.060000   0.020000   0.080000 ( 71.725848)
list images:     0.000000   0.000000   0.000000 (  0.000057)
destroy images:  0.030000   0.010000   0.040000 ( 99.656857)
require 'fog'
require 'pp'
require 'benchmark'
conn = nil
Benchmark.bm do |x|
x.report 'connection:'.ljust(15) do
conn = Fog::Image.new({
:provider => 'OpenStack',
@rubiojr
rubiojr / D10apt-ftparchive-hook
Created November 26, 2012 11:46
My pbuildderrc
#!/bin/bash
# 2009-04-09 tyler - use previously built packages as an apt source
# http://blog.edseek.com/~jasonb/articles/pbuilder_backports/pbuilderbuild.html#pbuilderhook
#
# Add this hook to ~/.pbuilder-hooks/D10apt-ftparchive and make it executable
#
echo Calling $0
: ${DIST:=$(lsb_release --short --codename)}
@rubiojr
rubiojr / cia
Created November 22, 2012 19:01
Dicen las malas lenguas que los agentes de la CIA han cambiado Unity por XFCE.
Las cámaras térmicas ya no detectan el calor que desprenden sus portátiles. #burnthehouse
@rubiojr
rubiojr / gist:4026486
Created November 6, 2012 18:13
thinkpad x40 kernel config 3.7.0-rc4
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.7.0-rc4 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
@rubiojr
rubiojr / pro-shell.sh
Created October 27, 2012 13:12
Unix Shell Pro-tips
# Print the config file of every package installed
for pkg in `dpkg -l|grep ii|awk '{print $2}'`;do
dpkg-query --showformat='${Conffiles}\n' --show $pkg | sed '/^$/d'
done
# dpigs - Show which installed packages occupy the most space
apt-get install debian-goodies && dpigs
@rubiojr
rubiojr / puppet-node-run.rb
Created October 18, 2012 19:34
Run an arbitrary command on every puppet node registered to the puppet master
#!/usr/bin/env ruby
require 'excon'
require 'json'
require 'net/dns'
include Net::DNS
#
# Run an arbitrary command using parallel-ssh against all the nodes
# registered in the puppet master
# Needs pssh (parallel-ssh) installed.
[10000][rubiojr.blueleaf] time git checkout master
Switched to branch 'master'
real 1m8.014s
user 0m7.408s
sys 0m52.855s