Skip to content

Instantly share code, notes, and snippets.

View oinak's full-sized avatar

Fernando Martínez oinak

View GitHub Profile
# Dieta para verano:
- desayuno: galletas de fibra + café/infusión (en mi caso limonada casera)
- media mañana: fruta (1 ó 2 melocotones o 3 rodajas piña al natural o 2 rodajas de sandía)
- comida: verdura hervida, a la plancha, en conserva o ensalada a tutiplén. Filete de vaca, de pollo o pescado blanco a la plancha. Sin límite de cantidad, cébate!
- media tarde: fruta, como a media mañana
- cena: como la comida + un yogur desnatado o infusión.
- Recomendaciones ;)
- si no la tienes, compra una sartén antiadherente de verdad y límpiala justo después de usarla: podrás hacer cosas a la plancha sin usar aceite y podrás usar más de este para aliñar ensaladas y verduras
- si echas de menos las salsas, prueba a combinar especias, cebolla, ajo, limón... sirven para animar cualquier plato, por insulso que sea
@oinak
oinak / jazzfonica.rb
Created July 3, 2011 10:10 — forked from christos/jazzfonica.rb
jazzfonica
#!/usr/bin/env ruby
# jazzfonica.rb for Mac OS X
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal
require 'digest/md5'
messages = []
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport')
@oinak
oinak / vpn.rb
Created November 18, 2011 07:53
Configure custom vpn's
#!/usr/bin/env ruby
require "rubygems" # ruby1.9 doesn't "require" it though
require "thor"
# The program takes different commands as in git thing style.
# At the moment it list avaiable/enable VPN's or sets them.
#
# Author:: Fernando Martínez (mailto:me@oinak.com)
# Copyright:: Copyright (c) 2010 LCIbérica SL
# License:: Distributes under the same terms as Ruby
@oinak
oinak / versionable.rb
Created October 16, 2012 22:16 — forked from txus/versionable.rb
Mindfuck of the day: versionable Ruby objects
# Note, some syntax inspired from that persistent data structures library for Ruby, Hamster??
# Scroll to the bottom to see it in action.
module Versioned
def self.included(base)
base.class_eval do
def self.new(*args)
new_mutable(*args).freeze
end
@oinak
oinak / rvm_compile_perf.txt
Created November 22, 2012 19:53
ruby performance change after rvm compile optimization
fer@hecate ~ $ echo "rvm_configure_env=(CFLAGS=-O3)" > ~/.rvmrc
fer@hecate ~ $ time ruby -e "count = 0; while(count < 100000000); count = count + 1; end; puts count"
100000000
real 0m6.324s
user 0m6.146s
sys 0m0.004s
fer@hecate ~ $ rvm reinstall ruby-1.9.3-head
@oinak
oinak / changes.md
Created November 23, 2012 23:28 — forked from funny-falcon/changes.md
Performace patch for ruby-1.9.3-p327 (debian notes)

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@oinak
oinak / mega_greeter.rb
Last active December 17, 2015 02:09
Curso de introducción a Ruby on Rails - Ej1
#!/usr/bin/env ruby
class MegaGreeter
end
if __FILE__ == $0
mg = MegaGreeter.new
mg.say_hi
mg.say_bye
@oinak
oinak / Gemfile
Created May 7, 2013 16:46
Curso de Introducción a Ruby on Rails - Ejercicio 2
source 'https://rubygems.org'
gem "sinatra", "~> 1.4.2"
gem "data_mapper", "~> 1.2.0"
gem "dm-sqlite-adapter", "~> 1.2.0"
gem "haml", "~> 4.0.1"
#!/bin/env ruby
class Time
Days = Day = 24 * 60 * 60
FixHolidays = Hash.new([]).merge(1 => [1,6], 5 => [1], 10 => [12], 12 => [25])
def self.holidays
@@holidays ||= Hash.new(Hash.new([])) # Year Specific holidays { 2013 => { 1 => [7,8]} }
end
@oinak
oinak / two.rb
Last active August 29, 2015 14:01
segundo ejercicio del taller de metaprogramacón
module Atribulator
module ClassMethods
def my_attr_reader(name)
define_method("#{name}") do
instance_variable_get("@#{name}")
end
end
def my_attr_writer(name, my_type = nil)
if my_type.nil?