Skip to content

Instantly share code, notes, and snippets.

View markbosky's full-sized avatar
💭
🤙

Mark Bosky markbosky

💭
🤙
View GitHub Profile
@markbosky
markbosky / excel-vba-delete-rows-containing-substring.bas
Created June 13, 2024 17:42
Excel VBA script to delete rows if first column contains a given substring
Sub DeleteRowsIfContainsSubstring()
Dim ws As Worksheet
Dim cell As Range
Dim deleteSubstring As String
Dim lastRow As Long
Dim i As Long
' Define the substring that will trigger row deletion
deleteSubstring = "/page/" ' Change this to your specific substring
@markbosky
markbosky / dns_info.py
Created May 23, 2024 19:12
Python script to check DNS info given a list of domains and output to text file
import dns.resolver
import sys
def get_dns_info(domain):
try:
result = {}
for record_type in ['A', 'AAAA', 'MX', 'NS', 'TXT', 'CNAME']:
try:
answers = dns.resolver.resolve(domain, record_type)
result[record_type] = [str(rdata) for rdata in answers]
@markbosky
markbosky / check_mx_records.py
Created May 23, 2024 18:04
Check MX Records for a list of given domains
import dns.resolver
def get_mx_records(domain):
"""Get MX records for a given domain."""
try:
answers = dns.resolver.resolve(domain, 'MX')
mx_records = [(r.exchange.to_text(), r.preference) for r in answers]
return mx_records
except (dns.resolver.NoAnswer, dns.resolver.NXDOMAIN, dns.resolver.Timeout) as e:
return f"Error retrieving MX records for {domain}: {str(e)}"
@markbosky
markbosky / simple-4-digit-list.js
Created February 9, 2023 05:06
generate and print a list of every four digit number combination excluding 0 has the first digit. Copy the list to the clipboard with each number on its own line
var combinations = [];
for (var i = 1000; i <= 9999; i++) {
if (i.toString().charAt(0) !== "0") {
combinations.push(i);
}
}
console.log(combinations.join("\n"));
// copy the list to the clipboard
var copyToClipboard = (str) => {
@markbosky
markbosky / marketo-block-email-domains.js
Created April 28, 2022 16:22
Marketo Email Domain Validation (Blocklist)
/*
* @author Sanford Whiteman
* @version v1.0 2020-10-22
* @copyright © 2020 Sanford Whiteman
* @license Hippocratic 2.1: This license must appear with all reproductions of this software.
* @https://nation.marketo.com/t5/product-discussions/how-do-i-get-a-form-to-display-an-error-message-in-real-time/td-p/306036
*
*
*/
(function () {
@markbosky
markbosky / tec-remove-susbscribe-dropdown.php
Created April 12, 2022 21:05
WordPress - The Events Calendar - Remove "subscribe to calendar" dropdown from the main calendar page and widget
<?php
// Remove subscribe to calendar dropdown from main calendar page
add_filter( 'tribe_template_html:events/v2/components/subscribe-links/list', '__return_false' );
@markbosky
markbosky / Restore_Windows_Photo_Viewer_CURRENT_USER.reg
Created February 26, 2022 19:15
Restore Windows Photo Viewer Application - Windows 10 Registry Tweak
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: June 27th 2016
; Updated on: May 7th 2019
; Tutorial: https://www.tenforums.com/tutorials/14312-restore-windows-photo-viewer-windows-10-a.html
[HKEY_CURRENT_USER\SOFTWARE\Classes\.bmp]
@markbosky
markbosky / Undo_Restore_Windows_Photo_Viewer_CURRENT_USER.reg
Created February 26, 2022 19:14
Undo Windows Photo Viewer Addition Registry Change - Windows 10
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: June 27th 2016
; Updated on: May 7th 2019
; Tutorial: https://www.tenforums.com/tutorials/14312-restore-windows-photo-viewer-windows-10-a.html
[HKEY_CURRENT_USER\SOFTWARE\Classes\.bmp]
@markbosky
markbosky / wp-remove-gutenberg-styles.php
Last active February 21, 2022 19:43
Remove Gutenberg Block Library CSS from loading on the frontend
<?php
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );
@markbosky
markbosky / wp-remove-admin-comments-section.php
Created December 30, 2021 18:48
WordPress - Remove Comments Menu from Admin Area
/**
* Removes comments from the left hand navigation in the admin.
*/
add_action( 'admin_menu', 'wp_remove_menus' );
function wp_remove_menus() {
global $menu;
global $submenu;
remove_menu_page( 'edit-comments.php' );
echo '';
}