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 | |
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 | |
# 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 | |
curl -C - -o arquivo_ja_salvo 'www.example.com/caminho/do/arquivo_ja_salvo' |
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 | |
* | |
FROM | |
INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
DATA_TYPE = 'VARCHAR' | |
-- Fonte: http://stackoverflow.com/a/2723185 |
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
-- 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 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
find / -name "*.txt" -exec grep "text here" {} \; -print 2>/dev/null |
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 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 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 defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false | |
sudo launchctl load /System/Library/LaunchDaemons/com.apple.screensharing.plist |
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 /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -off -restart -agent -privs -all -allowAccessFor -allUsers |