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 argparse | |
import os.path | |
import sys | |
import time | |
import traceback | |
# setup argument parser | |
# allows for use in more than one environment | |
parser = argparse.ArgumentParser(description='clean out Unimarket files and logs') | |
parser.add_argument('dir', metavar='dir', help='absolute file path of Unimarket application') |
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
from fabric import Connection | |
import requests | |
import yaml | |
if __name__ == "__main__": | |
# need to open our config file | |
with open('config.yaml', 'rb') as conf_file: | |
conf_data = conf_file.read() | |
config = yaml.load(conf_data, Loader=yaml.Loader) |
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
# script to use up 512 MB of memory | |
import time | |
some_str = bytearray(512000000) | |
while True: | |
time.sleep(60) | |
print('still holding on') |
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
# common security settings | |
# thanks to https://securityheaders.com | |
# these shouldn't vary between sites/applications | |
add_header X-Frame-Options SAMEORIGIN; | |
add_header X-XSS-Protection '1; mode=block'; | |
add_header X-Content-Type-Options nosniff; | |
add_header Referrer-Policy no-referrer-when-downgrade; | |
server_tokens off; |
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
# this is important! | |
Options FollowSymLinks | |
# Run Php without filename extension | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}\.php -f | |
RewriteRule ^(.*)$ $1.php [NC,L] | |
# Return 404 if original request is .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
#/bin/bash | |
# adding some sense of time | |
start_time=`date +%s` | |
# use wp-cli to generate list of site urls | |
/usr/local/bin/wp site list --field=url --path=/var/www > sites.log; | |
url="wp-cron.php"; | |
# read from our file and act on each line |
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-compose up -d | |
Creating network "wppusherplugin_default" with the default driver | |
Creating wppusherplugin_db_1 | |
Creating wppusherplugin_wordpress_1 | |
$ docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
ecec64717d29 wordpress:php5.6-apache "docker-entrypoint.sh" 5 seconds ago Up 2 seconds 0.0.0.0:80->80/tcp wppusherplugin_wordpress_1 | |
54ed735f15e4 mysql:5.7 "docker-entrypoint.sh" 7 seconds ago Up 4 seconds 3306/tcp wppusherplugin_db_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
SELECT | |
posts.ID, posts.post_title | |
FROM | |
wp.posts AS posts | |
INNER JOIN | |
wp.term_relationships AS rel ON posts.ID = rel.object_id | |
INNER JOIN | |
wp.term_taxonomy AS tax ON tax.term_taxonomy_id = rel.term_taxonomy_id | |
WHERE | |
tax.term_id = 17 AND post_type = 'post' |
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 | |
posts.ID, posts.post_title | |
FROM | |
wp.hpu_posts AS posts | |
INNER JOIN | |
wp.term_relationships AS rel ON posts.ID = rel.object_id | |
INNER JOIN | |
wp.term_taxonomy AS tax ON tax.term_taxonomy_id = rel.term_taxonomy_id | |
WHERE | |
tax.term_id = 17 |
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
FROM php:7.0 | |
RUN apt-get update -y && apt-get install -y openssl zip unzip mysql-client | |
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
RUN chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp | |
RUN docker-php-ext-install mbstring mysqli | |
WORKDIR /var/www | |
RUN wp core download --allow-root | |
RUN wp config create --dbname=project_db --dbuser=user_name --dbpass=SecretPassword --dbhost=host.docker.internal --allow-root | |
RUN wp core multisite-install --url=sites.example.com --title=Example --admin_user=starlord --admin_password=password --admin_email=starlord@example.com --skip-email --subdomains --allow-root |
NewerOlder