Skip to content

Instantly share code, notes, and snippets.

View dakoctba's full-sized avatar
🇧🇷
"Simplicity is the ultimate sophistication" - Leonardo da Vinci

Jackson Teixeira dakoctba

🇧🇷
"Simplicity is the ultimate sophistication" - Leonardo da Vinci
View GitHub Profile
@dakoctba
dakoctba / sync-fork
Created November 27, 2014 15:39
How to update GitHub forked repository?
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
@dakoctba
dakoctba / gist:2a4ffe9ab0db3d42f25b
Last active August 29, 2015 14:07
Fazendo backup com PostgreSQL

##Backup

$ pg_dump banco > arquivo.sql

###Backup de apenas uma tabela

$ pg_dump banco -t tabela > arquivo.sql

##Restore

@dakoctba
dakoctba / maven
Created September 30, 2014 17:20
maven
mvn archetype:generate -DgroupId=org.ccb.patrimonio -DartifactId=patrimonio -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
mvn eclipse:eclipse -Dwtpversion=2.0
@dakoctba
dakoctba / gist:d69fe98b22594237bbf6
Created September 19, 2014 20:44
Restart Postgres
/etc/init.d/postgresql restart
@dakoctba
dakoctba / gist:fc9a99044c1fa546bd32
Created September 17, 2014 21:52
Fazendo backup com PostgreSQL
O PostgreSQL oferece boas ferramentas para backup. Nesta dica vou explicar o funcionamento do pg_dump, a ferramenta mais usada para fazer backup no PostgreSQL.
No console do PostgreSQL no Linux, digite o seguinte comando:
$ pg_dump <nome_da_base_de_dados> > nome_arq_texto_bkp
Onde:
nome_da_base_de_dados: é o nome do banco de dados que você quer fazer o backup.
nome_arq_texto_bkp: este vai ser o arquivo que guardará todas as informações do banco de dados.
@dakoctba
dakoctba / gist:71db1180a844fc43b9b4
Created August 30, 2014 22:10
How to configure Apache 5.4 to run Silex
1) Ativar o módulo de redirecionamento de URL
sudo a2enmod rewrite
2) Entrar no arquivo /etc/apache2/sites-available/default e substituir todas as chamadas de "AllowOverride None" por "AllowOverride All"
3) Criar um arquivo ".htaccess" na raiz da aplicação com o seguinte conteúdo:
<IfModule mod_rewrite.c>
Options -MultiViews
@dakoctba
dakoctba / gist:e1fd1aa68915e27ab7a4
Created August 30, 2014 19:44
How to install php 5.4 on ubuntu
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
@dakoctba
dakoctba / gist:3532b4e23d9b32657c99
Last active August 29, 2015 14:03
PostgreSQL 9.4 & Vagrant (para usar com Rails)

Antes de tudo vamos corrigir o locale

Instalação

sudo apt-get remove postgresql -y
sudo apt-get install postgresql libpq-dev -y

Alterando permissões

Substitua a linha local all postgres peer por local all postgres md5 no arquivo /etc/postgresql/9.1/main/pg_hba.conf

@dakoctba
dakoctba / gist:246c38baa5d14e064e7e
Created June 26, 2014 14:45
Desinstalar Postgres por completo
sudo apt-get --purge remove postgresql postgresql-client postgresql-client-common
sudo apt-get autoremove
caso ainda fique alguma pasta: sudo rm -rfv opt/Postgres
@dakoctba
dakoctba / gist:10848137
Created April 16, 2014 10:21
How do I delete the unused COM ports in Windows 7?
The trick was to open the Command Prompt as administrator and start the Device Manager from the same command prompt.
1. Right-click “Command Prompt” in Accessories and choose “Run as Administrator”
2. Enter “set devmgr_show_nonpresent_devices=1″ – without the quotes obviously
3. Enter “start devmgmt.msc”
4. In the box that opens, select “Show hidden devices” in the ‘view’ menu.
Now if you expand the section on COM ports, all the COM ports that have ever
been created will be displayed, the non present ones being in grey. You can
uninstall away anything that you don’t want (right click, select uninstall).