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/sh | |
# | |
# Delete backup more than 90 days old. | |
# | |
backupDir="/var/lib/psa/dumps/tmp" | |
# | |
daysToKeep=90 | |
echo "Checking for files older than $daysToKeep days in $backupDir" | |
listOfFiles=`find $backupDir -mtime +$daysToKeep` |
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
Count IP's and sort in nginx access log | |
from: https://www.mkyong.com/nginx/count-ip-address-in-nginx-access-logs/ | |
``` | |
sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | |
``` |
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
``` | |
user='USER' | |
pname='php-fpm' | |
# get total memory usage of php-fpm | |
ps -U $user --no-headers -o rss -o command | grep $pname | awk '{ sum+=$1} END {print int(sum/1024) "MB"}' | |
# get total number of php-fpm processes + 1 | |
ps aux | grep $pname | wc -l |
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
PROXY_USER=... | |
PROXY_PASS=.... | |
PROXY_IP=185.XXX.XXX.XXX | |
PROXY_PORT=37257 |
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 | |
## Convert 'this/is a:string 123' to THIS_IS_A_STRING_123 | |
## | |
# converting a hard coded string to all uppercase with underscoree | |
echo "this/is a:string 123" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/_/g | sed -r s/^-+\|-+$//g | tr a-z A-Z | |
# output: THIS_IS_A_STRING_123 | |
# using variables variable |
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
{ | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:DescribeInstances", | |
"ec2:DescribeTags" | |
], | |
"Resource": "*" | |
} |
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 | |
// assume aws sdk is in composer: "aws/aws-sdk-php": "^3.0", | |
require __DIR__ . '/../../vendor/autoload.php'; | |
// load $AWS_KEY, $AWS_SECRET | |
require __DIR__ . '/../../local/credentials.php'; | |
$bucket = 'BUCKETNAME' | |
$awsCredentials = new \Aws\Credentials\Credentials($AWS_KEY, $AWS_SECRET); |
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 | |
return [ | |
'AD' => 'EUR', | |
'AE' => 'AED', | |
'AF' => 'AFN', | |
'AG' => 'XCD', | |
'AI' => 'XCD', | |
'AL' => 'ALL', | |
'AM' => 'AMD', |
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 -e | |
# Put this script in the root of the boot partition (i.e. system-boot) and chmod it with +x | |
# Set Variables | |
BTPATH=/boot/firmware | |
CKPATH=$BTPATH/vmlinuz | |
DKPATH=$BTPATH/vmlinux | |
#Check if compression needs to be done. | |
if [ -e $BTPATH/check.md5 ]; then |
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
output: | |
no callback: testing...destruct... | |
with callback: testing...callback...destruct... | |
with callback 2: testing...callback...destruct...was unset... | |
(destruct was always called so that's ok) |
OlderNewer