Skip to content

Instantly share code, notes, and snippets.

View odarriba's full-sized avatar
🚀

Óscar de Arriba odarriba

🚀
View GitHub Profile
@tjh
tjh / character_set_and_collation.rb
Created January 31, 2012 16:07
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''
@ravasthi
ravasthi / _config.yml
Created February 15, 2012 08:59
Multiple authors on Jekyll
authors:
hanzou:
name: Hanzou Hattori
display_name: Hanzou
gravatar: c66919cb194f96c696c1da0c47354a6a
email: hanzou@company.com
web: http://company.com
twitter: company
github: hhattori
jorgen:
@alialo
alialo / _config.yml
Created March 30, 2012 21:45
Twitter Bootstrap style pagination in Jekyll
paginate: 10
@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@L-A
L-A / moonobject.js
Created August 28, 2012 13:20
Moon phase calculation
var MoonInfo = function(day, month, year) {
var n0 = parseInt( "0" );
var f0 = parseFloat( "0.0" );
var AG = f0; // Moon's age
var DI = f0; // Moon's distance in earth radii
var LA = f0; // Moon's ecliptic latitude
var LO = f0; // Moon's ecliptic longitude
var Phase = " ";
var Zodiac = " ";
@mrichie
mrichie / gist:4043266
Created November 9, 2012 02:05 — forked from jfirebaugh/gist:4007524
Installing Ruby 2.0.0-preview1 with RVM on OS X
# First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1
# have recently been fixed.
#
# Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install
# a newer one with homebrew or the rvm pkg command.
# Option 1, with homebrew openssl:
brew update
brew install openssl
@agarie
agarie / gist:4753170
Created February 11, 2013 07:54
Installing ruby-opencv on OS X.
# Use Homebrew and be happy.
brew update
brew install opencv
# Give the correct pathnames. Of course, `2.4.3` is the current version at this time, change it accordingly.
gem install ruby-opencv -- --with-opencv-lib=/usr/local/Cellar/opencv/2.4.3/lib \
--with-opencv-include=/usr/local/Cellar/opencv/2.4.3/include/opencv \
--with-opencv-include=/usr/local/Cellar/opencv/2.4.3/include/opencv2
@enoliglesias
enoliglesias / sermepa_signature_sha256_confirmation.rb
Last active November 25, 2016 17:35
Ds_Signature creation for Sermepa with SHA256
def confirmation(credentials)
return false if params['ds_signature'].blank?
# The DES3-CBC key generation it's the same that in the creation gist
# You can take a look at the explanation
secret_key = credentials[:secret_key]
secret_key_base64 = Base64.strict_decode64(secret_key)
des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')
block_length = 8
des3.padding = 0
require 'net/http'
require 'uri'
require 'json'
def open(url)
Net::HTTP.get(URI.parse(url))
end
page_content = open('http://www.loteriasyapuestas.es/servicios/premioDecimoProvisionalWeb')
res_json = JSON.parse(page_content)
@porras
porras / xargs.md
Last active August 31, 2021 14:54

This is my best try at transcribing of the lightning talk I gave at RUG::B on April 2016. Due to poor time management (LOL) the delivery was rushed and some examples were skipped, I hope having them posted here makes them more useful.

xargs

xargs is a small but very useful program that is installed in most if not all of your computers¹. Many of you probably know it. Those who don't will learn something really useful, but those who do will learn a couple of cool tricks, too.

Why xargs

You might have heard about the Unix philosophy: