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
# https://premium.wpmudev.org/blog/understanding-file-permissions/ | |
# http://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships/ | |
# Change directory permissions to 755 (d, rwx, r-x, r-x) | |
sudo find . -type d -exec chmod 755 {} + | |
find /path/to/your/wordpress/ -type d -exec chmod 755 {} \; | |
# Change file permissions to 644 (-, rw-, r--, r--) | |
sudo find . -type f -exec chmod 644 {} + | |
find /path/to/your/wordpress/ -type f -exec chmod 644 {} \; |
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
# https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql | |
# https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial | |
# Create a new database | |
CREATE DATABASE somedatabase | |
# Create a new user | |
CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword'; | |
# Delete a user |
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
# https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | |
# https://mozilla.github.io/server-side-tls/ssl-config-generator/ | |
# Install letsencrypt | |
portmaster -ydbg --no-confirm security/py-letsencrypt | |
# Generate dhparam file | |
openssl dhparam -out dhparam.pem 4096 |
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
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
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 php ports | |
portmaster -L | grep php | sed -e "s/===>>> //g" | sed -e "s/-5.6.18_1//g" | sed -e "s/-5.6.18//g" | sed -e "s/-1.0//g" | |
# Uninstall ports | |
portmaster -L | grep php | sed -e "s/===>>> //g" | sed -e "s/-5.6.18_1//g" | sed -e "s/-5.6.18//g" | sed -e "s/-1.0//g" | xargs -I {} sh -c 'portmaster -ye --no-confirm {}' | |
php56 | |
php56-ctype | |
php56-curl |
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
### Start screen session ### | |
# http://stackoverflow.com/questions/7049252/how-to-create-a-screen-executing-given-command | |
function exec_in_screen() { | |
name=$1 | |
command=$2 | |
screen -dmS $name sh; screen -S $name -X stuff "$command\n"; | |
} | |
exec_in_screen "test" "ls" |
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
@echo off | |
TITLE Find DNS TXT records for example.com | |
:dnslookup | |
nslookup -type=TXT example.com | |
GOTO wait | |
:wait | |
ping 127.0.0.1 -n 30 > nul |
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
cat access.log | cut -d' ' -f1 | sort | uniq | |
# cat access.log Get contents of access.log | |
# cut -d' ' -f1 Split lines on space and get first part | |
# sort Sort lines | |
# uniq Get unique lines |
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 all lines not beginning with an # | |
cat somefile | grep -v "^#" | |
# split all lines to get only the part before the first # | |
cat somefile | cut -d'#' -f1 | |
# remove all comments | |
cat somefile | grep -v "^#" | cut -d'#' -f1 | |
# List all users |
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
MD5_FILE="md5_file" | |
FILE="somefile" | |
# create MD5 of somefile | |
md5=`md5 $FILE | cut -d'=' -f2 | tr -d " "` | |
# Write md5 to file | |
md5 > $MD5_FILE | |
# Get MD5 from file |