Skip to content

Instantly share code, notes, and snippets.

@markbosky
markbosky / Powershell-Reference-Examples-TextSearch.sh
Last active February 27, 2025 05:18
Quick Commands For Searching Strings Across Text Files (Powershell)
#Powershell
Get-ChildItem -Path . -Recurse -Filter *.txt | Select-String -Pattern "whatever/.com" | ForEach-Object { "$($_.Path): Line $($_.LineNumber): $($_.Line)`n" } |
Out-File -FilePath results.txt
Get-ChildItem -Path . -Recurse -Filter *.txt | Select-String -Pattern "\@whatever\.com" | ForEach-Object { "$($_.Path): Line $($_.LineNumber): $($_.Line)`n" } | Out-File -FilePath "results_$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').txt"
@markbosky
markbosky / remove-post-sitemap-sitemap-index-yoast-seo.php
Created March 12, 2025 22:36
Remove post-sitemap.xml link from sitemap_index.xml in Yoast SEO WordPress
<?php
//Remove post-sitemap.xml from Yoast Sitemap index without affecting indexability
add_filter('wpseo_sitemap_index_links', function ($sitemaps) {
foreach ($sitemaps as $key => $sitemap) {
if (isset($sitemap['loc']) && strpos($sitemap['loc'], 'post-sitemap.xml') !== false) {
unset($sitemaps[$key]);
}
}
return $sitemaps;
});
@markbosky
markbosky / regex-match-time-in-datetime-list.txt
Created January 14, 2026 20:48
RegEx to Match Time In a Date Time List
Example List:
7/27/16 22:14
7/8/16 17:24
6/28/16 0:06
6/14/16 3:40
6/4/16 12:53
5/26/16 17:29
5/3/16 2:44
4/19/16 3:05
4/5/16 19:00