Skip to content

Instantly share code, notes, and snippets.

@ffabreti
ffabreti / pg_extract.sh
Created August 7, 2018 11:09 — forked from brock/pg_extract.sh
Extract all databases (or one by name) from a sql file created by pg_dumpall
#!/bin/bash
# extract all postgres databases from a sql file created by pg_dumpall
# this script outputs one .sql file for each database in the original .sql file
# unless you pass the name of a database in the dump
if [ $# -lt 1 ]
then
echo "Usage: $0 <postgresql sql dump> [dbname]" >&2
exit 1
fi
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/ffabreti/0512fb5705926ae7f5ee34536a0e28db/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
function die {
[ec2-user@ip-172-31-49-17 ~]$ wget https://gist.githubusercontent.com/ffabreti/0512fb5705926ae7f5ee34536a0e28db/raw/97304371c0476ddcf0ae76151b20faf895bbd94b/install-redis.sh
--2016-04-01 20:06:43-- https://gist.githubusercontent.com/ffabreti/0512fb5705926ae7f5ee34536a0e28db/raw/97304371c0476ddcf0ae76151b20faf895bbd94b/install-redis.sh
Resolvendo gist.githubusercontent.com (gist.githubusercontent.com)... 199.27.76.133
Conectando-se a gist.githubusercontent.com (gist.githubusercontent.com)|199.27.76.133|:443... conectado.
A requisição HTTP foi enviada, aguardando resposta... 200 OK
Tamanho: 6690 (6,5K) [text/plain]
Salvando em: “install-redis.sh”
install-redis.sh 100%[=========================================================================>] 6,53K --.-KB/s em 0s
@ffabreti
ffabreti / install-redis.sh
Last active April 6, 2016 01:57 — forked from four43/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/ffabreti/0512fb5705926ae7f5ee34536a0e28db/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
function die {
migration:
rake db:migrate VERSION=0
@ffabreti
ffabreti / ionic
Last active August 29, 2015 14:15
IONIC
ERROS:
================================================
ao tentar iniciar o android emulator:
ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
ko:failed to initialize KVM
1) desligar máquinas virtuais VIRTUALBOX
2) sudo /etc/init.d/vboxdrv stop
================================================
-- conectar via FreeTDS
TDSVER=7.1 tsql -H <serverName> -p 1433 -U <domain>\\<user> -P `cat pass.txt`
-- fim de comando
go
-- selecionar o banco
use <dbname>
-- info sobre tabela
@ffabreti
ffabreti / Fedora Yum Commands
Last active August 29, 2015 14:04
Fedora Packages
##############################################
#query what packages depend upon XXX
repoquery --whatrequires --installed XXX
##############################################
#remove a repo named XXX
cd /etc/yum.repos.d/
mv XXX.repo XXX.repo.not
ATT: However, each .repo file can and usually have more than one yum repository defined in it
##############################################
#query installed package content
###################################################
#configuring authentication of a linux box with Microsoft Active-Directory
#refer: http://wiki.ubuntu-br.org/AutenticandoAD
$ apt-get install krb5-config krb5-user
$ vi /etc/krb5.conf
[libdefaults]
default_realm = DOMAIN.BR
default_tgs_enctypes = RC4-HMAC DES-CBC-MD5 DES-CBC-CRC
-------------------------------------------------------
copy table FROM SHELL between distinct database files:
--------------------------------------------------------
sqlite3 source.sqlite3 ".schema myTable" | sqlite3 destination.sqlite3
sqlite3 source.sqlite3 "SELECT * FROM myTable" | sqlite3 destination.sqlite3 ".import /dev/stdin myTable"
---------------------------------------------
import data into table:
---------------------------------------------
$ head cbo_ocupacoes.csv