This file contains 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 sqltext.TEXT, | |
req.session_id, | |
req.status, | |
req.command, | |
req.cpu_time, | |
req.total_elapsed_time | |
FROM sys.dm_exec_requests req | |
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext | |
-- Uma das colunas acima é a <code>session_id</code>. |
This file contains 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
find / -name "*.txt" -exec grep "text here" {} \; -print 2>/dev/null |
This file contains 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
-- Lista as tabelas de um banco de dados SQL Server, | |
-- junto com o nro. de registros, e tamanho de cada tabela. | |
-- Fonte: http://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database | |
SELECT | |
t.NAME AS Entidade, | |
p.rows AS Registros, | |
SUM(a.total_pages) * 8 AS EspacoTotalKB, | |
SUM(a.used_pages) * 8 AS EspacoUsadoKB, | |
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS EspacoNaoUsadoKB |
This file contains 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 | |
* | |
FROM | |
INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
DATA_TYPE = 'VARCHAR' | |
-- Fonte: http://stackoverflow.com/a/2723185 |
This file contains 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 | |
curl -C - -o arquivo_ja_salvo 'www.example.com/caminho/do/arquivo_ja_salvo' |
This file contains 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 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 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 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 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 |