Skip to content

Instantly share code, notes, and snippets.

View lauborges's full-sized avatar
💭
I may be slow to respond.

Lau Borges lauborges

💭
I may be slow to respond.
View GitHub Profile
@lauborges
lauborges / github_repos.rb
Created July 24, 2011 23:50 — forked from akitaonrails/github_repos.rb
manage all github repositories (yours and watched) with a single command.
#!/usr/bin/env ruby
#
# Brute-force way to retrieve all Github's repositories at once
# Usage:
# github_repos.rb clone # will clone all the user's repositories
# github_repos.rb clone test # will just clone 6 repositories for testing purposes
# github_repos.rb pull # will update all of the user's local repositories
#
# If you have forked repositories, the original sources will be added
# as remotes with the default 'forked_from' name, and a new 'forked_from'
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
class PopulaEstadosCidades < ActiveRecord::Migration
def self.up
Estado.create(:sigla => 'AC', :nome => "Acre") do |e|
e.cidades.build(:nome => "Acrelândia")
e.cidades.build(:nome => "Assis Brasil")
e.cidades.build(:nome => "Brasiléia")
e.cidades.build(:nome => "Bujari")
e.cidades.build(:nome => "Capixaba")
e.cidades.build(:nome => "Cruzeiro do Sul")
e.cidades.build(:nome => "Epitaciolândia")
/*
* Copyright 2013, Cassiano Rabelo (http://www.cassianorabelo.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @Copyright Copyright 2013, Cassiano Rabelo (http://www.cassianorabelo.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* Date: 01/03/2013
* Fonte: http://www.ibge.gov.br/cidadesat
@lauborges
lauborges / dump.sql
Created February 21, 2013 19:57 — forked from manfe/dump.sql
-- Os dados contidos nesse arquivo foram extraídos do site: http://ibge.gov.br/cidadesat utilizando ruby, nokogiri e expressões regulares.
-- Autor: Mauricio Natanael Ferreira
-- Github: https://github.com/manfe
-- Twitter: @manfe01
-- Email: contato [at] ferreiramauricio [dot] com
-- ***********************************************************************************************************************************************
-- id ...
@lauborges
lauborges / change-postgresql-password
Created June 13, 2013 23:55
Postgresql 9.1 set default password on Ubuntu 12.04
sudo -u postgres psql postgres
postgres=# ALTER USER postgres WITH PASSWORD '<newpassword>';
@lauborges
lauborges / gist:8042578
Created December 19, 2013 17:00
check disk space for large folders
du -h -a / | grep "[0-9]G\b"
@lauborges
lauborges / gist:8043526
Last active December 31, 2015 20:59
check used port
sudo netstat -lnp |grep :25
lsof -Pni | grep LIST | grep ":25"
@lauborges
lauborges / gist:8499057
Last active January 3, 2016 17:59
Fix - postgresql duplicate key violates unique constraint
ActiveRecord::Base.connection.reset_pk_sequence!('entities')
ActiveRecord::Base.connection.tables.map do |model|
ActiveRecord::Base.connection.reset_pk_sequence!(model.downcase)
end
@lauborges
lauborges / npm-sudo-fix
Created June 22, 2014 23:51
npm sudo fix
sudo chown -R `whoami` ~/.npm
sudo chown -R $USER /usr/local