Skip to content

Instantly share code, notes, and snippets.

View lcguida's full-sized avatar
🏠

Leandro Guida lcguida

🏠
View GitHub Profile
@lcguida
lcguida / universities_to_yaml.rb
Last active August 29, 2015 14:22
Universities Worldwide to YAML (Converts all information from http://univ.cc to a YAML file)
require 'open-uri'
require 'nokogiri'
require 'yaml'
start = 1
INCREMENT = 50
has_more = true
File.open('universities.yml', 'w') do |file|
while has_more do
@lcguida
lcguida / gem_downloader.rb
Last active August 29, 2015 14:03
Downloads all the gems from a Gemfile.lock. Inspired by https://gist.github.com/flavio/1722530
require 'rubygems'
require 'bundler'
require 'fileutils'
TMP_DIR = "/tmp/gems"
#If directory exists, delete it and recreates.
FileUtils.rm_rf(TMP_DIR) if File.exists?(TMP_DIR)
FileUtils.mkdir TMP_DIR
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
require 'dm-timestamps'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "mysql://root@localhost/db_development")
class Tester
include DataMapper::Resource
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto