Skip to content

Instantly share code, notes, and snippets.

@skolo-online
skolo-online / blog.py
Created December 28, 2021 12:16
AI Blog Generator Tool
import os
import openai
import config
openai.api_key = config.OPENAI_API_KEY
def generateBlogTopics(prompt1):
response = openai.Completion.create(
@CapWebSolutions
CapWebSolutions / sec-scan-root.sh
Last active April 23, 2024 15:47
Latest iteration of security scanning script for MainWP instance.
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website.
# It uses the same services as WP CLI, so if WP CLI runs, this should also.
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
cd /var/www/capwebwpcare.com/htdocs
// Change the following constants to your country of choice
const population = 5837213;
const herdImmunityPercentage = 70;
// Go to https://github.com/owid/covid-19-data/tree/master/public/data/vaccinations/country_data and find the raw URL for your country
const dataUrl = "https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/country_data/Denmark.csv";
// -------------------------
// With caching and fallback
const cacheMinutes = 60; // 60 min
@mattsson
mattsson / Vaccination Status.js
Last active January 13, 2021 12:43
Vaccination Status
// Constants you can change
const citizensInDenmark = 5837213
const herdImmunityPercentage = 0.65
const url = "https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/country_data/Denmark.csv"
// Set constants
const totalVaccinationsNeeded = citizensInDenmark * herdImmunityPercentage * 2
const widget = new ListWidget()
widget.spacing = 4
@marco79cgn
marco79cgn / vaccination-stats.js
Last active January 11, 2023 21:47
A Scriptable widget that shows the amount of people who have received the corona vaccination in Germany
// Version 1.3.0
// 27.11.2021
//
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: notes-medical;
// Mit Caching und Fallback
const cacheMinutes = 60; // 60 min
const today = new Date();
const neededTotalVaccinations = 83200000;
@CapWebSolutions
CapWebSolutions / sec-scan-v5.sh
Created January 3, 2020 01:07
Perform MainWP Security scan on all configured sites from terminal
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
wp mainwp sites | cut -c3-4 | grep -E '([0-9]|[0-9][0-9])' | sed 's/^/wp mainwp-sucuri scan /' > sec-scan-auto.sh
#
@Mediatros
Mediatros / adzhosts.txt
Created September 13, 2019 08:42 — forked from roddhjav/adzhosts.txt
AdZHosts
This file has been truncated, but you can view the full file.
# AdZHosts v0206 - FiX [2018-05-15]
#
# Archive of AdZHosts v0206.
#
# Former url: https://adzhosts.fr/hosts/adzhosts-android.txt
#
0.0.0.0 ___id___.c.mystat-in.net
0.0.0.0 _thums.ero-advertising.com

Theme Builder Hooks

The Theme Builder provides a number of hooks allowing you to add wrapper HTML tags or fill in your custom theme's header or footer if necessary, when Theme Builder is active for the current page.

The Theme Builder and custom themes

When used in a custom theme, the Theme Builder may replace the header, body, footer or some combination of the previous depending on how the user configures their templates. Due to the nature of headers and footers in custom themes the Theme Builder will always treat them as a pair meaning that if you use a layout for either, both will be overridden.

As a custom theme developer, you may wish to add support for the Theme Builder so that when only the header is replaced your custom footer is still shown or when the footer is replaced your custom header is still shown. To achieve this you should use the provided layout hooks.

@sebastianmoran-mainwp
sebastianmoran-mainwp / Commands
Last active February 15, 2021 17:18
WP-CLI very handy wp doctor commands
wp doctor check --all
wp doctor check autoload-options-size
wp doctor check cron-count
wp doctor cron-duplicates
wp doctor plugin-active-count
wp doctor check option-blog-public
@bogdan-mainwp
bogdan-mainwp / custom-report-pdf-paper-size.php
Last active January 12, 2021 11:14
Custom code snippet for setting the custom paper size for the client report PDF.
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_client_report_pdf_page_format', 'mycustom_pdf_page_format', 10 , 1 );
function mycustom_pdf_page_format( $format = '' ) {
return 'A4';
}