Skip to content

Instantly share code, notes, and snippets.

View mitchellkrogza's full-sized avatar
🤓
Busy ... Always busy

Mitchell Krog mitchellkrogza

🤓
Busy ... Always busy
View GitHub Profile
@mitchellkrogza
mitchellkrogza / gist:3c92f79060502b2167e96abd2f2bf5d0
Created September 17, 2024 08:28
PiHole Log Monitor with Email Alerts
#!/bin/bash
# Run this from Cron using @reboot - the script runs continiously
# Change your email address below
# Change pi.hole (Line 31) to your own PiHole Hostname
# Change search terms in the array below (Line 9) to whatever words you want to monitor
# Define the log file and search terms
LOG_FILE="/var/log/pihole/pihole.log"
SEARCH_TERMS="xvid|porn|hamster|gay|faphouse|boyfriend|xnxx|maletube|cock|chaturbate|stripchat|streamen|flirt|jizz|boys|2gochat|dragy|grindr|hoop|likee"
ALERT_EMAIL="you@youremail.com" # Replace with your email address
@mitchellkrogza
mitchellkrogza / get_bot_ip_addresses.py
Created March 24, 2024 12:14 — forked from eliasdabbas/get_bot_ip_addresses.py
Get the most up-to-date list of IP addresses for crawler bots, belonging to Google and Bing.
import ipaddress
import requests
import pandas as pd
def bot_ip_addresses():
bots_urls = {
'google': 'https://developers.google.com/search/apis/ipranges/googlebot.json',
'bing': 'https://www.bing.com/toolbox/bingbot.json'
}
@mitchellkrogza
mitchellkrogza / google-recaptcha.php
Created December 6, 2023 05:53 — forked from joshcanhelp/google-recaptcha.php
Add a Google RECAPTCHA and honeypot to a WordPress registration form
<?php
/**
* Adds first and last name to the registration field
*/
function proper_add_user_reg_fields () {
?>
<p class="reg-email-validation">
<label for="confirm_email_address">
@mitchellkrogza
mitchellkrogza / maketimelapse.bat
Created May 25, 2023 08:06
Windows Timelapse Making Script
This requires
- ffmpeg.exe binary on your desktop
- video input file named input.mp4
- audio file for timelapse called timelapsemusic.mp3
- your finished timelapse will be called MYTIMELAPSE.mp4
- change the username in cd C:\Users\Username\Desktop to your real username on windows
- Speed up or slow down the timelapse by changing the setpts=PTS/80 to a higher or lower value
- Example setpts=PTS/200 = very fast timelapse
- Example setpts=PTS/50 = slower timelapse
DO NOT COPY ANY OF THE ABOVE LINES INTO YOUR .bat file
@mitchellkrogza
mitchellkrogza / flatsome-change-sale-button
Created May 15, 2022 11:45
Flatsome theme Change Sale Button Text
add_filter( 'flatsome_product_labels', function ( $text, $post, $product, $badge_style ) {
if ( $product->is_on_sale() ) {
$text = '<div class="badgeonsale callout badge-label"><div class="badge-inneronsale callout-onsale-bg is-small onsale-bubble">ON SALE</div></div>' . $text;
}
return $text;
}, 10, 4 );
@mitchellkrogza
mitchellkrogza / woocommerce-change-add-to-cart-button-text
Created March 21, 2022 13:44
Woocommerce Change "Add to Cart" button text
// To change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
}
// To change add to cart text on product archives(Collection) page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
@mitchellkrogza
mitchellkrogza / woocommerce-wcfm-marketplace-notify-user-product-deletion
Created March 5, 2022 09:31
Woocommerce WCFM Marketplace Notify User of Product Deletion
// ======================================================================================
// Notify user of product deletion
// Applies to any Woocommerce product but was written specifically for WCFM Marketplace
// Copyright Bjorn Patje & Mitchell Krog (thank you Bjorn)
// ======================================================================================
// This sends an email to the owner (user) of a product when it is deleted / trashed
// The email uses simple html formatting and php variables
// Modify the contents of the $body varaible and $subject variable to your liking
// ======================================================================================
add_action( 'delete_post', 'notification_for_product', 99 );
@mitchellkrogza
mitchellkrogza / flatsome-theme-change-product-titles-to-h2
Last active March 5, 2022 07:24
Flatsome Theme Change Shop & Category Loop Product Title from <p> to <h2>
/**
* Flatsome Theme
* Change Shop & Catalog Product Titles from <p> to <h2>
* Adjust to <h3> <h4> <h5> <h6> as you require.
*/
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {
function woocommerce_template_loop_product_title() {
echo '<h2 class="name product-title ' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">';
woocommerce_template_loop_product_link_open();
@mitchellkrogza
mitchellkrogza / woocommerce-change-backorder-message
Last active February 23, 2022 08:50
Woocommerce Change Backorder Message
// CHANGE WOOCOMMERCE BACKORDER TEXT
// Here I have used a 3 line message with inline styles to change the color and add line breaks
// Adapt this as you see fit
// Use Code Snippets Plugin to add this function or add yourself to functions.php of your child theme
// https://wordpress.org/plugins/code-snippets/
function mywoo_backorder_message( $text, $product ){
if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
$text = __( '<strong><p style="color:green">New Stock is on its way !!!!<br>Backorder now - first come first served<br>Please allow 1 – 3 weeks for delivery of this item</p></strong><br>', 'your-textdomain' );
}
@mitchellkrogza
mitchellkrogza / flatsome-disable-navigation-thumbnails
Created February 21, 2022 09:57
Flatsome Theme - Disable Product Navigation Thumbnails
if(!function_exists('flatsome_next_post_link_product')) {
function flatsome_next_post_link_product() {
global $post;
$next_post = get_next_post(true,'','product_cat');
if ( is_a( $next_post , 'WP_Post' ) ) { ?>
<li class="prod-dropdown has-dropdown">
<a href="<?php echo get_the_permalink( $next_post->ID ); ?>" title="View Previous Product" rel="next" class="button icon is-outline circle">
<?php echo get_flatsome_icon('icon-angle-left'); ?>
</a>
</li>