Skip to content

Instantly share code, notes, and snippets.

View jesusangelm's full-sized avatar

Jesus Marin jesusangelm

View GitHub Profile
@jesusangelm
jesusangelm / MB_enviados_recibidos.rb
Created May 19, 2011 17:26
Script para obtener los Mb enviados y recibidos por una interfaz de red determinada
#Script para obtener los Mb enviados y recibidos por
#una interfaz de red determinada.
#incluye una funcion para convertir Bytes a MB
#tiene unas pequeñas fallas que pronto arreglare! :)
def bytestomb bytes
mb = bytes.to_f / (1024*1024)
mb
end
@jesusangelm
jesusangelm / cumple1.rb
Created January 20, 2012 21:29
Script en Ruby para felicitar a una persona por su cumpleaños - Version sencilla
#!/usr/bin/env ruby
# coding: utf-8
puts "Favor ingresa tu nombre"
nombre = gets.chomp
puts "#{nombre} cuantos años cumples???"
anios = gets.chomp.to_i
anios.times do |num|
puts "#{num.to_s} Feliz Cumpleaños #{nombre}!!!"
@jesusangelm
jesusangelm / cumplePOO.rb
Created January 20, 2012 21:31
Script en Ruby para felicitar a una persona por su cumpleaños - Version POO
#!/usr/bin/env ruby
#coding: utf-8
# Felicitador V2.0 POO
class Cumple
def initialize(nombre, anios)
@minombre = nombre
@mianios = anios
end
@jesusangelm
jesusangelm / wordpress_importer.rb
Created March 22, 2012 02:39 — forked from stammy/wordpress_importer.rb
Importa los post de un blog WordPress a .MarkDown para Jekyll
# based on the import script by icebreaker, which is based on mojombo's
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# https://gist.github.com/303570
# edited to rewrite image URLs to use my CloudFront URL
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
@jesusangelm
jesusangelm / lector.rb
Created May 24, 2012 17:41
simple script de prueba que lee el archivo de texto que se le pase como argumento.
#!/usr/bin/env ruby
def leer archivo
File.foreach(archivo).with_index do |linea, indice |
puts "#{indice}: #{linea}"
end
end
if ARGV.size > 1
puts "Este script solo admite un argumento!"
@jesusangelm
jesusangelm / .gitignore
Created May 29, 2012 19:06
mi .gitignore snippet
# Ignore bundler config
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
@jesusangelm
jesusangelm / prueba.rb
Created November 5, 2012 17:30
borrar el registro de la tarea con la nota mas baja de cada estudiante en la BD MongoDB
require "mongo"
connection = Mongo::Connection.new("localhost", 27017)
db = connection.db("students")
coll = db.collection("grades")
199.times do |n|
doc = coll.find("student_id" => n, "type" => "homework").sort(:score => :asc).limit(1)
@jesusangelm
jesusangelm / tmux.conf
Last active December 18, 2015 19:49
mi tmux.conf
#configs para Tmux
#shell por defecto
#set -g default-command /bin/zsh
#set -g default-shell /bin/zsh
#tecla de prefijo de Tmux cambiada similar a Screen: Ctrl-a
#de Ctrl-b a Ctrl-a
set -g prefix C-a
@jesusangelm
jesusangelm / .fonts.conf
Created June 22, 2013 02:11
mi .fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hinting" >
@jesusangelm
jesusangelm / .gemrc
Created June 22, 2013 02:12
mi gemrc config
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri