Skip to content

Instantly share code, notes, and snippets.

@tjrobinson
tjrobinson / es-curator.ps1
Created May 14, 2015 08:05
es-curator.ps1
# get indexes in "logstash" alias
$indexes = Invoke-RestMethod "http://localhost: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
$indexNames|sort |%{
$datePart = $_.Substring(9)
$indexAge = [datetime]::UtcNow.Date.Subtract([DateTime]::Parse($datePart)).Days
@tjrobinson
tjrobinson / install-psget.ps1
Created June 22, 2015 14:19
install-psget.ps1 - suitable for use as part of a Group Policy Object
function Install-PsGet {
$Destination = "C:\Windows\System32\WindowsPowerShell\v1.0\Modules"
New-Item -Path ($Destination + "\PsGet\") -ItemType Directory -Force | Out-Null
Write-Host 'Downloading PsGet from https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1'
$client = (New-Object Net.WebClient)
$client.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$client.DownloadFile("https://github.com/psget/psget/raw/master/PsGet/PsGet.psm1", $Destination + "\PsGet\PsGet.psm1")
Write-Host "PsGet is installed and ready to use" -Foreground Green
}
# 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])"
}
@tjrobinson
tjrobinson / InstallHubFlow.ps1
Created October 9, 2017 09:07 — forked from mastilver/InstallHubFlow.ps1
Hubflow windows installer
Add-Type -AssemblyName System.IO.Compression.FileSystem
$TEMP = $([environment]::GetEnvironmentVariable("TEMP", "User"))
$CWD = $(Split-Path $MyInvocation.MyCommand.Path)
$PATH = $([environment]::GetEnvironmentVariable("PATH", "User"))
$git_folder = "C:\Program Files\Git"
$git_bin_folder = "$($git_folder)\bin"
$tmp_folder = "$($TEMP)\$([guid]::NewGuid())";
@tjrobinson
tjrobinson / keybase.md
Created September 11, 2019 10:37
Keybase proof

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@tjrobinson
tjrobinson / AutoMocker.cs
Created March 20, 2021 17:50
AutoMocker experiments
// @nuget: Moq.AutoMock -Version 2.3.0
using System;
using Moq;
using Moq.AutoMock;
public interface IMyService
{
string GetValue();
}