Skip to content

Instantly share code, notes, and snippets.

David De Sloovere DavidDeSloovere

Block or report user

Report or block DavidDeSloovere

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
DavidDeSloovere / upload.cs
Created Nov 17, 2016
SFTP upload with SSH.NET
View upload.cs
const string host = "";
const string username = "chucknorris";
const string password = "norrischuck";
const string workingdirectory = "/highway/hell";
const string uploadfile = @"c:\yourfilegoeshere.txt";
Console.WriteLine("Creating client and connecting");
using (var client = new SftpClient(host, port, username, password))
DavidDeSloovere / _Layout.cshtml
Last active Nov 9, 2018
Config HTTP headers. Adds X-Content-Type-Options and remove X-Powered-By for every request and X-UA-Compatible for views.
View _Layout.cshtml
<!DOCTYPE html>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
DavidDeSloovere / vsts-build-custom-var-creation.ps1
Last active Aug 13, 2018
Create a custom variable in VSTS build powershell task
View vsts-build-custom-var-creation.ps1
#output to stdout in special format
Write-Host ("##vso[task.setvariable variable=ThisIsMyVariable;]somevalue")
# reuse in subsequent tasks
View boxstarter_apps
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -DisableShowHiddenFilesFoldersDrives -DisableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
# Disable defrag (no need when having an SSD)
DavidDeSloovere /
Last active Mar 2, 2018
Make PowerShell prettier and display Git status

Install Scoop A command-line installer for Windows

iex (new-object net.webclient).downloadstring('')

Install concfg concfg is a utility to import and export Windows console settings like fonts and colors.

DavidDeSloovere / run.csx
Created Nov 17, 2016
View run.csx
// full repo at
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
log.Info("Webhook was triggered!");
string jsonContent = await req.Content.ReadAsStringAsync();
dynamic data = JsonConvert.DeserializeObject(jsonContent);
DavidDeSloovere / dump-env-variables.ps1
Last active Feb 5, 2017
TEAM BUILD PowerShell: Output all documented environment variables
View dump-env-variables.ps1
# Team Foundation Build environment variables
Write-Host "TF_BUILD : $Env:TF_BUILD "
DavidDeSloovere / gist:6277610
Last active Dec 21, 2015
System.Net.HttpResponseMessage set custom status code like 429
View gist:6277610
var response = new HttpResponseMessage
StatusCode = (HttpStatusCode)429,
ReasonPhrase = "Too Many Requests",
Content = new StringContent(string.Format(CultureInfo.InvariantCulture, "Rate limit reached. Reset in {0} seconds.", data.ResetSeconds))
response.Headers.Add("Retry-After", data.ResetSeconds.ToString(CultureInfo.InvariantCulture));
actionContext.Response = response;
DavidDeSloovere / JsonNetResult
Created Jun 1, 2013
JsonNetResult for ASP.NET MVC - correct formatting of dates and camel cased properties Got most of the code from Stack Overflow.
View JsonNetResult
using System;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
public class JsonNetResult : JsonResult
public override void ExecuteResult(ControllerContext context)
DavidDeSloovere / CopyChmLocalAndOpen.ps1
Created Jan 4, 2013
Open up an old school .CHM help file from a network path. Put the Powershell in the folder of the .CHM file and any user can launch the help file via right-click on the .PS1 and selecting 'Run with Powershell'. (Set-ExecutionPolicy might need to be set first)
View CopyChmLocalAndOpen.ps1
$tempfolder = $env:TEMP
$chmfile = Get-ChildItem | Where-Object {$_.Extension -match "chm"}
"Copying to local temp folder: $tempfolder"
Copy-Item $chmfile $tempfolder
"Opening $chmfile"
Start-Process $tempfolder\$chmfile
You can’t perform that action at this time.