Skip to content

Instantly share code, notes, and snippets.

AndyPook / Dockerfile
Created Jul 26, 2019
Docker file for docfx
View Dockerfile
FROM debian:stretch-slim
# Install system components
RUN apt-get update
RUN apt-get install -y curl apt-transport-https dirmngr gnupg ca-certificates unzip
RUN apt-key adv --keyserver hkp:// --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# Import the public repository GPG keys
RUN curl | apt-key add -

Keybase proof

I hereby claim:

  • I am andypook on github.
  • I am andypook ( on keybase.
  • I have a public key ASDTiKH0PWmgycLyEv9erqHBwKrpqc9ap3OAUUKSmbdzRgo

To claim this, I am signing this object:

AndyPook / boxstarter
Last active May 11, 2017
boxstarter script
View boxstarter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess -EnableShowRecentFilesInQuickAccess -EnableShowFrequentFoldersInQuickAccess -EnableExpandToOpenFolder
Update-ExecutionPolicy Unrestricted -Force
cinst chocolatey
cinst Boxstarter
View ElasticObject.cs
public sealed class ElasticObject : DynamicObject, IDictionary<String, Object>, ICloneable, INotifyPropertyChanged
private static readonly String [] SpecialKeys = new String[] { "$Path", "$Parent", "$Root", "$Value", "$Type" };
private readonly IDictionary<String, Object> values = new Dictionary<String, Object>();
private Object value;
private ElasticObject parent;
AndyPook / SemVer.cs
Last active Mar 29, 2016
Class to parse SemVer strings and extract version from current process
View SemVer.cs
/// <summary>
/// Parses a full product version string into component parts
/// </summary>
public sealed class SemVer : IComparable<SemVer>
public static readonly SemVer Null = new SemVer((string)null);
public static SemVer GetFromPath(string path)
if (!File.Exists(path))
AndyPook / profile.ps1
Created Mar 9, 2016
powershell script to import VisualStudio environment variables
View profile.ps1
# Set environment variables for Visual Studio Command Prompt
# Based on:
pushd "c:\Program Files (x86)\Microsoft Visual Studio ${version}.0\Common7\Tools"
cmd /c "vsvars32.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=")
set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
AndyPook / es-curator.ps1
Created Mar 9, 2016
very simple powershell script to delete older logstash indexes
View es-curator.ps1
# get indexes in "logstash" alias
$indexes = Invoke-RestMethod "http://eshost:9200/logstash/_settings"
# get the names of the indexes
$indexNames = Get-Member -InputObject $indexes -MemberType NoteProperty|%{$_.Name}
# foreach index check its age. If over 10 days, delete it
# "Substring(9)" returns the date part of "logstash-yyyy-mm-dd"
$indexNames|sort |%{
$datePart = $_.Substring(9)
AndyPook / Arrays.cs
Last active Mar 9, 2016
Equivalent of Enumerable.Empty<T> but returns an ICollection<T> (an empty array)
View Arrays.cs
public static class Arrays
public static T[] Empty<T>() { return EmptyArray<T>.Instance; }
public static class EmptyArray<T>
public static readonly T[] Instance = new T[0];
AndyPook / Queuehandler.cs
Last active Mar 9, 2016
Allows for separation of a producer (eg a network receiver) from a potentially more expensive consumer
View Queuehandler.cs
public class QueueHandler<T>
public static QueueHandler<T> Start(Action<T> handler, CancellationToken? token = null, ParallelOptions options = null)
var q = new QueueHandler<T>(handler, token, options);
return q;
public QueueHandler(Action<T> handler, CancellationToken? token = null, ParallelOptions options = null)