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
@eliasdabbas
eliasdabbas / get_bot_ip_addresses.py
Last active March 24, 2024 12:14
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 / Cerbot Renewals with Mini(Conda) Python, Bash and Cron - Foolproof and Failproof Renewal Script
Last active October 1, 2019 09:10
Fool proof and fail proof Cerbot SSL certificate automated renewal script using a miniConda Python environment, bash and cron.
#!/bin/bash
# -----------------------------------------------------------
# Mini(Conda) Environment for Failproof Certbot Renewals
# Created by Mitchell Krog: https://github.com/mitchellkrogza
# Copyright Mitchell Krog: https://github.com/mitchellkrogza
# GIST: https://gist.github.com/mitchellkrogza/547a850a34d022009e5d80e896684eac
# Last Updated: 2019-10-01 11:11:00 SAST
# -----------------------------------------------------------
# Save as certbot-renewals.sh
@pklaus
pklaus / rpi3-arch-linux-to-sdcard.sh
Last active February 3, 2023 01:58
Raspberry Pi 3: Arch Linux ARM 64bit to SDcard Script. This is for the Rapsberry Pi 3. For the RPi 2 (or the 3 32bit), see https://gist.github.com/pklaus/9dd4a7bf040788cda501 . For the RPi 1, see https://gist.github.com/pklaus/b92dfc72136d1509c2ed .
#!/bin/bash
# <https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3>
echo -e "\n\nArch Linux ARM to SD Card"
echo -e "For the Raspberry Pi 3, if you want to use the unofficial arm64 variant."
echo -e "(Otherwise use the Raspberry Pi 2 version of this script!)\n\n"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
#!/bin/bash
################################
# OS X Install ISO Creater #
# #
# Author: shela #
################################
#######################################
# Declarations
@mitchellkrogza
mitchellkrogza / fail2ban-reset-log-db.sh
Last active June 25, 2022 13:36
Bash script to reset Fail2Ban - clears / truncates log file and deletes the sqlite database - stops and restarts service during this process.
#!/bin/bash
# Bash Script by https://gist.github.com/mitchellkrogza
# ************************************************************
# This script clears the log file and database of Fail2Ban
# This resets Fail2Ban to a completely clean state
# Useful to use after you have finished testing all your jails
# and completed your initial setup of Fail2Ban and are now
# putting the server into LIVE mode
# ************************************************************
certbot revoke -d your-site.com -d your-site.net
<?php
// Version CSS file in a theme
wp_enqueue_style(
'theme-styles',
get_stylesheet_directory_uri() . '/style.css',
array(),
filemtime( get_stylesheet_directory() . '/style.css' )
);
@joshcanhelp
joshcanhelp / google-recaptcha.php
Last active December 6, 2023 05:53
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">
@fishkingsin
fishkingsin / fb_post_photo.sh
Created September 9, 2013 10:00
post photo with curl and facebook graph
curl 'https://graph.facebook.com/me/photos' -F 'access_token=access_token' -F 'source=@'$1 -F 'message='$(date +"%Y-%m-%d-%S")
@gherkins
gherkins / image_xml_sitemap.php
Created October 20, 2012 17:04
Create Google (Image) XML Sitemaps using PHP
header("Content-type: text/xml; charset=utf-8");
//create your XML document, using the namespaces
$urlset = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" /><!--?xml version="1.0" encoding="UTF-8"?-->');
//iterate over your sites pages or whatever you like
foreach (getMyPagesOrWhatEver() as $item):
//add the page URL to the XML urlset