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
View SampleResponsive.html
<picture>
<source srcset="/media/bdpjq2s3/umbracologolarge.png?mode=pad&width=420" media="(max-width: 480px)" sizes="420px" />
<source srcset="/media/bdpjq2s3/umbracologolarge.png?mode=pad&width=720" media="(max-width: 768px)" sizes="720px" />
<source srcset="/media/bdpjq2s3/umbracologolarge.png?mode=pad&width=960" sizes="960px" />
<img src="/media/bdpjq2s3/umbracologolarge.png" alt="Umbraco logo" />
</picture>
@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)){
}
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))}
View AddAvailabilityRestrictedIPApp.ps1
Param(
[Parameter(Mandatory = $true)]
[string] $ResourceGroupName,
[Parameter(Mandatory = $true)]
[string] $AppServiceName,
[Parameter(Mandatory = $true)]
[string] $SubscriptionId,
[Parameter(Mandatory = $true)]
[string] $RulePriority
)
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 Sep 20, 2019
Dynamic Robots.cshtml robots.txt file for Umbraco, learn more at https://swimburger.net/blog/umbraco/crawling-through-umbraco-with-robots
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
You can’t perform that action at this time.