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 | |
# Fontes: | |
# http://glassonionblog.wordpress.com/2011/04/08/tomcat-redirecting-traffic-from-port-8080-to-80-using-iptables/ | |
# http://stackoverflow.com/a/12454607 | |
# Faz o redirecionamento | |
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 | |
# Para remover o redirecionamento: |
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 | |
sudo apt-get install --no-install-recommends open-vm-dkms | |
sudo apt-get install open-vm-tools | |
sudo shutdown -r now | |
# Caso troque o kernel, deve ser removido e reinstalado: | |
#sudo apt-get remove open-vm-tools | |
#sudo apt-get remove open-vm-dkms | |
#sudo shutdown -r now |
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 | |
# Substitua "user" pelo nome de usuário | |
# "host" pelo nome ou endereço IP do servidor remoto | |
# "/var/log/messages" pelo arquivo que você quer exibir. | |
ssh user@host "tail -f /var/log/messages" |
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 |
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
-- 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
#!/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
-- 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/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
#!/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 |