Skip to content

Instantly share code, notes, and snippets.

Andy Pook AndyPook

Block or report user

Report or block AndyPook

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
@AndyPook
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://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# Import the public repository GPG keys
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
View keybase.md

Keybase proof

I hereby claim:

  • I am andypook on github.
  • I am andypook (https://keybase.io/andypook) on keybase.
  • I have a public key ASDTiKH0PWmgycLyEv9erqHBwKrpqc9ap3OAUUKSmbdzRgo

To claim this, I am signing this object:

@AndyPook
AndyPook / boxstarter
Last active May 11, 2017
boxstarter script
View boxstarter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess -EnableShowRecentFilesInQuickAccess -EnableShowFrequentFoldersInQuickAccess -EnableExpandToOpenFolder
Enable-RemoteDesktop
Update-ExecutionPolicy Unrestricted -Force
Disable-InternetExplorerESC
Disable-BingSearch
cinst chocolatey
cinst Boxstarter
View ElasticObject.cs
[Serializable]
[TypeConverter(typeof(ElasticObjectTypeConverter))]
[TypeDescriptionProvider(typeof(ElasticObjectTypeDescriptionProvider))]
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
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
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: http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-2010-command-prompt
$version=14
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
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
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
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);
q.Start();
return q;
}
public QueueHandler(Action<T> handler, CancellationToken? token = null, ParallelOptions options = null)
You can’t perform that action at this time.