This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file --mime-type -b ${1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adicione um novo remote; pode chamá-lo de "upstream": | |
git remote add upstream https://github.com/usuario/projeto.git | |
# Obtenha todos os branches deste novo remote, | |
# como o upstream/master por exemplo: | |
git fetch upstream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Cria o índice, se ele não existe | |
DO $$ BEGIN IF NOT EXISTS ( | |
SELECT | |
1 | |
FROM | |
pg_class c | |
JOIN | |
pg_namespace n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# script para adicionar apt.postgresql.org ao sources.list | |
# da linha de comando | |
CODENAME="$1" | |
# lsb_release é o melhor, mas nem sempre disponível | |
if [ -z "$CODENAME" ]; then | |
CODENAME=$(lsb_release -cs 2>/dev/null) | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NODE_ENV="production" | |
NODE_APP='index.js' | |
APP_DIR='/opt/syonet/screenshot-service'; | |
PID_FILE=$APP_DIR/app.pid | |
LOG_FILE=$APP_DIR/app.log | |
CONFIG_DIR=$APP_DIR | |
PORT=4001 | |
NODE_EXEC=`which node` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Usa as estatísticas do PostgreSQL para a contagem. | |
-- Para números mais precisos, execute | |
-- VACUUM ANALYZE | |
-- antes de iniciar. | |
SELECT | |
relname, | |
n_live_tup | |
FROM | |
pg_stat_user_tables | |
ORDER BY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Primeiro, verifica o nome e o caminho do arquivo .out, dentro do .tar.bz2 | |
tar --list --file=backup.tar.bz2 | |
# | |
# Vamos supor que o arquivo backup.tar.bz2 tem os seguintes arquivos: | |
# | |
# script.sh | |
# README.txt | |
# backup/saida.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Gera queries do tipo CREATE INDEX para todos os índices de um banco de dados. | |
select | |
'CREATE INDEX '|| index_name || ' ON ' || table_name || ' ( ' || colunas || ' );' | |
from | |
(select | |
table_name, | |
index_name, | |
array_to_string ( ARRAY ( select | |
a.attname as column_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
TABLE_NAME AS TABELA, | |
COLUMN_NAME AS CAMPO | |
FROM | |
INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
COLUMN_NAME LIKE 'nome_campo%' -- Exemplo: 'id_empresa%' | |
AND COLUMN_NAME <> 'nome_campo_exclusao' -- Exemplo: 'id_empresaerp' | |
ORDER BY | |
TABELA ASC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://archives.postgresql.org/pgsql-admin/2010-05/msg00285.php | |
# Gera linhas de configuração que podem ser adicionadas ao sysctl | |
# com base no total de RAM do sistema. A saída | |
# permite até 50% da memória física para ser alocada como | |
# shared memory. | |
# No Linux, você pode usar desta forma (como root): | |
# | |
# ./shmsetup >> /etc/sysctl.conf |