Skip to content

Instantly share code, notes, and snippets.

Chris McKenzie crmckenzie

Block or report user

Report or block crmckenzie

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
@crmckenzie
crmckenzie / Watch.ps1
Last active Aug 18, 2017
Pester-Watch
View Watch.ps1
param([switch] $Start)
function New-FileSystemWatcher(
[Parameter(Mandatory)][ValidateNotNullOrEmpty()] [string] $TargetFile,
[Parameter(Mandatory)][ValidateNotNull()] [ScriptBlock] $Action
) {
$fullPath = Resolve-Path $TargetFile
$fsw= New-Object System.IO.FileSystemWatcher
$fsw.Path = (Split-Path $fullPath -Parent)
View Enable-RunAsDifferentUser-Windows10.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer]
"ShowRunAsDifferentUserInStart"=dword:00000001
View crmckenzie-box-starter.ps1
# BoxStarter script
#START http://boxstarter.org/package/nr/url?<raw url>
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Move-LibraryDirectory "Personal" "$env:UserProfile\OneDrive\documents"
cinst 7zip
cinst chrome
View ServiceHealth.cs
public class ServiceHealthStatus
{
public string Type { get; set; }
public string Status { get; set; }
public string[] Messages { get; set; }
public string Name { get; set; }
public string Data { get; set; }
}
public class ServiceHealthController : ApiController
@crmckenzie
crmckenzie / sample.cs
Created May 4, 2016
Web Api + OData + AutoMapper + HyperMedia
View sample.cs
[System.Web.Http.HttpGet]
[System.Web.OData.EnableQuery]
[System.Web.Http.Route("~/api/v1/widgets/query", Name = "widgets-query")]
[ResponseType(typeof(List<widgetJson>))]
public IQueryable<widgetJson> Query(ODataQueryOptions<WidgetEntity> query)
{
var odata = query.ApplyTo(_dbContext.widgets)
.Cast<WidgetEntity>()
.ToList()
View install-developer-dependencies.js
var fs = require('fs');
fs.readFile('package.json', 'utf8', function(err, data){
console.log("reading package.json");
if (err) throw err;
obj = JSON.parse(data);
if (obj.devDependencies) {
View install-developer-dependencies.js
var fs = require('fs');
fs.readFile('package.json', 'utf8', function(err, data){
console.log("reading package.json");
if (err) throw err;
obj = JSON.parse(data);
if (obj.devDependencies) {
View ExecuteSql.cs
public int ExecuteSql(string sql, object parameters = null)
{
int result;
using (var connection = ConnectToDb())
using (var command = new SqlCommand(sql, connection))
{
Log.Info(sql);
if (parameters != null)
@crmckenzie
crmckenzie / xd2md.cs
Created Feb 19, 2016 — forked from formix/xd2md.cs
Generates Markdown From VisualSturio XML documentation files
View xd2md.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace Formix.Utils
{
class Program
View Install-ApacheTomcat.ps1
# https://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html
# https://shieldmaster.wordpress.com/2013/06/01/installing-apache-tomcat-v7-x-silently-with-command-line-options/
$defaultTomcatVersion = "8.0.30"
function Get-TomcatFilename(
[string] $version = $defaultTomcatVersion
)
{
return "apache-tomcat-$version.exe"
You can’t perform that action at this time.