Skip to content

Instantly share code, notes, and snippets.

View aitor's full-sized avatar
👊
Working!

Aitor García Rey aitor

👊
Working!
View GitHub Profile
require 'colored'
def add_desert_require
sentinel = 'Rails::Initializer.run do |config|'
gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
"\nrequire 'desert'\n#{match}"
end
end
def gsub_file(path, regexp, *args, &block)
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
# Mimic Mac OS X Finder's sort by name.
class Array
def finder_sort
sort { |a, b| a.to_finder_sort <=> b.to_finder_sort }
end
end
class String
def to_finder_sort
result = self.dup
javascript:location.href='http://readcycling.com/?input_url='+encodeURIComponent(location.href)
javascript:location.href='http://readcycling.com/?input_url='+encodeURIComponent(location.href)
@aitor
aitor / license
Created January 27, 2010 10:34 — forked from defunkt/license
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
year=`date "+%Y"`
cat <<EOF
Copyright (c) $year Aitor García
Permission is hereby granted, free of charge, to any person obtaining
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'icalendar'
require 'date'
include Icalendar
class IrekiaCalendar
BASE_URL = "http://irekia.euskadi.net/es/dept/all/events?archive=f"
# How fucking fucked can the most fucked up company get when messing around when formats?
# Well, really fucked.
# So fix their fucking mess: Telefonica pk7 invoices to pdf
# Use: ruby fucktura.rb file_name.pk7
require 'base64'
FACT_LABEL=/<FACB64>(.*)<\/FACB64>/m
fucktura = File.open(ARGV[0]).read[FACT_LABEL, 1]
Nameservers for .de domains:
* The first 3 bits of the IP address (C-class) is different for each nameserver.
* A glue record is necessary for the domain on the nameservers.
* The SOA (Start of Authority) must be within the guidelines.
* The domain MX record must resolve to a mail server that is valid for the life of the domain registration.
* The DNS servers must be located on two distinct class C networks.
* The zone files for both nameservers must have matching serial numbers.
* The primary and secondary hosts specified in both zone files must match the first and second nameservers entered.
[aitor@Sofocles:~ 14:13:21] ruby -e 'puts "¿" =~ /\W/'
0
[aitor@Sofocles:~ 14:13:24] ruby -v
ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]