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
# No passphrase (!important), save as [name]_ed25519 | |
ssh-keygen -t ed25519 | |
# File ~/.ssh/config | |
Hostname gitlab.com | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/[filename] | |
User [username] | |
# Add to known hosts |
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
# Change id_rsa by your ~/.ssh private key file | |
# SHA256 version | |
ssh-keygen -l -f id_rsa | |
# MD5 version | |
ssh-keygen -l -E md5 -f id_rsa |
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
# Add to server section | |
# Cloudflare https://www.cloudflare.com/ips | |
set_real_ip_from 103.21.244.0/22; | |
set_real_ip_from 103.22.200.0/22; | |
set_real_ip_from 103.31.4.0/22; | |
set_real_ip_from 104.16.0.0/13; | |
set_real_ip_from 104.24.0.0/14; | |
set_real_ip_from 104.16.0.0/12; | |
set_real_ip_from 108.162.192.0/18; | |
set_real_ip_from 131.0.72.0/22; |
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
# Log format | |
log_format main '$remote_addr - $remote_user [$time_local] $request ' | |
'"$status" $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
log_format main2 '$remote_addr - $remote_user [$time_local] $request ' | |
'"$status" $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for" ' | |
'"$host" $request_time'; | |
log_format bytes '$body_bytes_sent'; | |
access_log /var/log/nginx/access.log main2; |
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
{ | |
"Version": "2017-08-28", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "s3:ListAllMyBuckets", | |
"Resource": "arn:aws:s3:::*" | |
}, | |
{ | |
"Sid": "the-Sid", |
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
UPDATE wp_posts SET post_content = REPLACE(post_content, "http://base-dev-url/", "http://base-prod-url/") WHERE post_content LIKE "%http://base-dev-url/%" |
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
set_error_handler('myHandlerForMinorErrors', E_NOTICE | E_STRICT); | |
function myHandlerForMinorErrors() {} |
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
DB::enableQueryLog(); | |
[.. query ..] | |
error_log(print_r(DB::getQueryLog(), true)); |
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
1. Modify /composer.json -> "autoload": { .. "files": [.. | |
2. Run "composer dump-autoload" | |
3. Optionally add aliases in config/app.php |
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
# Filter log by hour and minute | |
sudo cat /my/log/path | grep "11\/Mar\/2015\:09\:3" | grep -v "[avoid server ip address]" > filtered.log | |
# # Filter log by hour and minute avoiding certain file extensions | |
sudo cat /my/log/path | grep "11\/Mar\/2015\:09\:3" | grep -v "\.css" | grep -v "\.js" | grep -v "\.png" | grep -v "\.jpg" | grep -v "\.jpeg" | grep -v "\.gif" | grep -v "\/wp-admin\/" > filtered.log | |
# Sort 10 IPs ordered by requests | |
awk '{print $1}' filtered.log | sort | uniq -c | sort -n | tail -10 | |
# Sort 10 IPS and DNS ordered by requests |
NewerOlder