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 | |
var1="important-value" | |
echo "SEVER BASH - stats here" | |
ssh -i ./key.pem user@example.com <<-SSHBASH | |
echo "Successfully connected to example.com" | |
ls -l ./public_html/index.html | |
echo "Echo Var1 Value: $var1" |
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 | |
input="./urls.txt" # input file for list of URLs | |
output="./result.txt" # output file | |
echo "ResponseCode, URL" > $output | |
while IFS= read -r line | |
do | |
status_code=$(curl --write-out %{http_code} --silent --output /dev/null $line) | |
outputStr=$(echo "$status_code, $line") | |
echo $outputStr | |
echo $outputStr >> $output |
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
tmpDir="/tmp" | |
randomName=`date +'%s'``php -r "echo rand();"` | |
awsUser="xxxxxxx" | |
awsAcID="xxxxxxxxxxxxx" | |
region="xx-xxxx-xx" | |
if [[ ! "$1" ]] ; then | |
echo "You must supply MFA." | |
exit 1 |
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
# stop mysql | |
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist | |
# start mysql | |
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist |
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
<?php | |
function findnumber($numbers) | |
{ | |
$count = count($numbers); | |
for ($i = 1; $i <= $count; $i++) | |
{ | |
$flag = true; | |
for ($j = 0; $j < $count; $j++) | |
{ |
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
mkdir -p /main_folder/sub_folder/child_folder |
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 | |
'Total size in mysql' as `DB / Table Name`, | |
SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024),2)) AS `SizeInMB`, | |
SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024 / 1024),2)) AS `SizeInGB` | |
FROM | |
information_schema.TABLES | |
UNION | |
SELECT |
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
grep -v "USE \`db_name\`" database.sql > database-without-name.sql |
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
# import mysql database in docker container | |
docker exec -i mysql-container mysql -uuser -ppassword name_db < database-dump.sql | |
# export mysql database from docker container | |
docker exec -i mysql-container mysqldump -uroot -proot name_db > database-dump.sql |