Skip to content

Instantly share code, notes, and snippets.

🆘
Stuck in vim

Niels Swimberghe Swimburger

🆘
Stuck in vim
Block or report user

Report or block Swimburger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Swimburger
Swimburger / SeleniumHeadlessChromeDriver.cs
Last active Jul 25, 2019
C# instantiate ChromeDriver in headless mode
View SeleniumHeadlessChromeDriver.cs
var options = new ChromeOptions();
options.AddArgument("headless");
using(var driver = new ChromeDriver(".", options)){
}
@Swimburger
Swimburger / RemoveLogFiles.ps1
Created Jul 3, 2019
Delete files last modified more than 30 days ago
View RemoveLogFiles.ps1
$LogFolder = "D:\home\site\wwwroot\App_Data\Logs";
$DaysToKeepLogsAround = 30;
Get-ChildItem -Path $LogFolder -Recurse -File | Where LastWriteTime -lt (Get-Date).AddDays(-$DaysToKeepLogsAround) | Remove-Item -Force
View GetFolderSizes.ps1
Get-ChildItem -Directory | ForEach {$_.FullName + (" {0:N2} MB" -f ((Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB))}
@Swimburger
Swimburger / AddAvailabilityRestrictedIPApp.ps1
Last active Jul 3, 2019
PowerShell scripts to bulk add IP ranges to Restricted Access feature of Azure App Service
View AddAvailabilityRestrictedIPApp.ps1
Param(
[Parameter(Mandatory = $true)]
[string] $ResourceGroupName,
[Parameter(Mandatory = $true)]
[string] $AppServiceName,
[Parameter(Mandatory = $true)]
[string] $SubscriptionId,
[Parameter(Mandatory = $true)]
[string] $RulePriority
)
@Swimburger
Swimburger / PurgeCloudflareCache.ps1
Created Feb 19, 2019
Purge Cloudflare Cache using Cloudflare's API in PowerShell
View PurgeCloudflareCache.ps1
Function PurgeAllCloudflareCache{
Param(
[parameter(Mandatory=$true)]
[string] $AdminEmail,
[parameter(Mandatory=$true)]
[string] $ApiKey,
[parameter(Mandatory=$true)]
[string] $ZoneId
);
View CrawlSitemap.ps1
Function CrawlSitemap
{
Param(
[parameter(Mandatory=$true)]
[string] $SiteMapUrl
);
$SiteMapXml = Invoke-WebRequest -Uri $SiteMapUrl -UseBasicParsing -TimeoutSec 180;
$Urls = ([xml]$SiteMapXml).urlset.ChildNodes
ForEach ($Url in $Urls){
@Swimburger
Swimburger / CrawlSite.ps1
Last active Jan 25, 2019
Crawl your website links and images to find broken links/images using PowerShell
View CrawlSite.ps1
Param(
[Parameter(Mandatory=$true)]
[string] $Url,
[Parameter(Mandatory=$true)]
[int] $MaxPages,
[bool] $IncludeImages = $true,
[bool] $StayOnDomain = $true,
[bool] $IgnoreFragments = $true)
$Domain = [Uri]::new($Url).Host;
@Swimburger
Swimburger / Robots.chtml
Last active Oct 10, 2018
Dynamic Robots.cshtml robots.txt file for Umbraco
View Robots.chtml
@inherits UmbracoTemplatePage
@{
Layout = null;
umbraco.library.ChangeContentType("text/plain");
var rootUrl = Request.Url.GetLeftPart(UriPartial.Authority);
}Sitemap: @string.Format("{0}{1}", rootUrl, "/sitemap.xml")
User-agent: *
Disallow: /umbraco
@Swimburger
Swimburger / robots.txt
Created Oct 10, 2018
Robots.txt example with sitemap
View robots.txt
Sitemap: https://swimburger.net/sitemap.xml
User-agent: *
Disallow: /umbraco
@Swimburger
Swimburger / IISRewriteRules.config
Created Oct 8, 2018
Redirect to lowercase URL redirect IIS web.config
View IISRewriteRules.config
<rule name="Convert to lower case" stopProcessing="true">
<match url=".*[A-Z].*" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />
</rule>
You can’t perform that action at this time.