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
for i in $(sudo -u www-data wp site list --field=url); \ | |
do | |
echo ${i}; \ | |
a="$(sudo -u www-data wp user list --url=${i} --role=SuperUser --field=user_login)"; \ | |
if [[ ! -z "${a}" ]]; then \ | |
sudo -u www-data wp user --url="${i}" update "${a}" --role "administrator"; \ | |
echo "User ${a} updated for site ${i}."; \ | |
fi; \ | |
done |
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
sudo file -s /dev/xvd* | |
/dev/xvda: DOS/MBR boot sector | |
/dev/xvda1: Linux rev 1.0 ext4 filesystem data, UUID=651cda91-e465-4685-b697-67aa07181279, volume name "cloudimg-rootfs" (needs journal recovery) (extents) (64bit) (large files) (huge files) | |
sudo growpart /dev/xvda 1 | |
sudo resize2fs /dev/xvda1 |
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 | |
pat='([0-9]{2}/[0-9]{2}/[0-9]{2}).(.*)\ (-?[0-9,]+\.[0-9]{2})' | |
while IFS= read -r line; do | |
[[ $line =~ $pat ]] && | |
echo "${BASH_REMATCH[1]}|${BASH_REMATCH[2]}|${BASH_REMATCH[3]}" | |
done <file.txt |
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 | |
TOKEN="" | |
REPO="" # format: username/repository | |
EVENT_TYPE="" | |
curl -H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Authorization: token ${TOKEN}" \ | |
--request POST \ | |
--data '{"event_type": "${EVENT_TYPE}"}' \ |
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 | |
# Find includes that start with escape character | |
grep -R '@include \"\\' | |
# Find files that end with ico and have a random 8 character filename. | |
find . | egrep "\.[0-9a-z]{8}.ico" | |
# Find files with ico code include injected at the top. |
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
for i in $(find ./wp-content/plugins -maxdepth 1 ! -path . -type d) | |
do | |
sudo mv ${i} ${i}.old | |
echo "Disabled ${i}" | |
read -p "Press enter to continue" | |
done |
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
docker inspect -f "{{.Path}} {{.Args}} ({{.Id}})" $(docker ps -a -q) | |
Source: https://stackoverflow.com/questions/30441035/how-to-find-the-cmd-command-of-a-docker-image |
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 | |
# (c) Wolfgang Ziegler // fago | |
# | |
# Inotify script to trigger a command on file changes. | |
# | |
# The script triggers the command as soon as a file event occurs. Events | |
# occurring during command execution are aggregated and trigger a single command | |
# execution only. | |
# | |
# Usage example: Trigger rsync for synchronizing file changes. |
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 | |
wp search-replace '\<img style="width: 0; height: 0; display: none; visibility: hidden;" src="(https?:)?\/\/linkojager\.org\/.+\/\>' '' --regex | |
wp search-replace '\<script.+src="(https?:)?\/\/linkojager\.org\/.+\<\/script\>' '' --regex |
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
#!/usr/bin/env bash | |
# | |
# This is a rudimentary script to merge wordpress single site into existing multisite | |
# | |
site1_directory="" # path to single site installation. example: /sites/google.com/public | |
site2_directory="" # path to new multisite installation. | |
new_blog_id="" # the new blog id | |
cd ${site1_directory} && \ |
NewerOlder