Skip to content

Instantly share code, notes, and snippets.

View amccool's full-sized avatar

Alex McCool amccool

  • Rauland-Borg
  • North Texas
View GitHub Profile
mkdir C:\apps\otel-collector
set-location C:\apps\otel-collector
# download
wget.exe https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.83.0/otelcol-contrib_0.83.0_windows_amd64.tar.gz
#extract
#C:\Windows\System32\tar.exe xvfz .\otelcol-contrib_0.83.0_windows_amd64.tar.gz
Install-Package -ProviderName PowerShellGet 7Zip4PowerShell -Force
@amccool
amccool / break-add-type.ps1
Last active October 23, 2019 23:07
show the calling add-type throws invalidoperationexception when the environment is large
#Get-ChildItem -Path Env:\
# add more than 64k of environment variables
$variableNameToAdd = "x"
$variableValueToAdd = "xxxxx"
#[System.Environment]::SetEnvironmentVariable($variableNameToAdd, $variableValueToAdd, [System.EnvironmentVariableTarget]::Machine)
#[System.Environment]::SetEnvironmentVariable($variableNameToAdd, $variableValueToAdd, [System.EnvironmentVariableTarget]::Process)
@amccool
amccool / SSLPerfectForwardSecrecyTLS12.ps1
Created February 7, 2019 05:46 — forked from guitarrapc/SSLPerfectForwardSecrecyTLS12.ps1
DSC Configuration for SSL PerfectForwardSecrecyTLS12 with https://weakdh.org/sysadmin.html issue. Use GraniResource within configuration https://github.com/guitarrapc/DSCResources/tree/master/Custom
configuration SSLPerfectForwardSecrecyTLS12
{
Import-DscResource -ModuleName GraniResource
#region Protcol Configuration
# Disable Multi-Protocol Unified Hello
Registry "DisableServerMultiProtocolUnifiedHello"
{
Key = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server"
@amccool
amccool / fork forced sync
Last active January 24, 2018 23:59 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git remote update
git reset --hard upstream/master
@amccool
amccool / consolidate-first-nuget
Last active October 18, 2017 05:59
Visual Studio Package Manager Console - Consolidate first package
#do just one
get-package | Group-Object Id | foreach { [pscustomobject]@{ packagename=$_.Name; VG=$_.Group ;versions=($_.Group |select -expandproperty versions |select -ExpandProperty Version); versionMAX=($_.Group |select -expandproperty versions |select -ExpandProperty Version |sort -property versions -descending |select -last 1) } } | foreach { [pscustomobject]@{ packagename=$_.packagename; VG=$_.VG; versions=$_.versions; versionCount= $_.versions.Count; versionMAX=$_.versionMAX }} | where versionCount -gt 1 | foreach { [pscustomobject]@{ packagename=$_.packagename; VG=$_.VG; versions=$_.versions; versionMAX=$_.versionMAX; dversions=($_.versions | select -Unique) }} | foreach { [pscustomobject]@{ packagename=$_.packagename; VG=$_.VG; versionMAX=$_.versionMAX; PN=$_.VG.ProjectName; versions=$_.versions; dversionCount=$_.dversions.Count }} | where dversionCount -gt 1 | select -first 1 | foreach { foreach($v in $_.VG) { update-package -Id $v.Id -Version $_.versionMAX -projectname $v.ProjectName } }
@amccool
amccool / gist:7a22bd3142a9ccfbb01e98c96bdc1dc0
Last active October 17, 2017 23:22
list project framework versions
gci -r -Filter *.csproj -PipelineVariable projectname | select-xml '//*[local-name()="TargetFrameworkVersion"]' | Select-Object -Expand Node -PipelineVariable version | foreach { [pscustomobject]@{ proj=$projectname.FullName; version = $version.InnerXML}} | sort -Property version| format-table version,proj
$p = get-package
$p | select -ExpandProperty Versions -Property ProcessName, Id, ProjectName | format-table
$flatp = $p | select -ExpandProperty Versions -Property ProcessName, Id, ProjectName
$flatp = $flatp | select -Property Id, ProjectName, Version
$groupedpackages = $flatp | group Id
$packwithmorthanone = $groupedpackages | where { $_.Group.Count -gt 1}
@amccool
amccool / consolidate.ps1
Last active October 6, 2017 19:33
batch consolidate
$grouped = get-package | Group-Object Id
$morethanone = $grouped | where-object {$_.Count -gt 1}
foreach($pkg in $morethanone) { $max = $pkg.Group | sort Version -descending | select -first 1; $maxFirstVersion = $max.Versions | select -first 1; foreach($proj in $pkg.Group) { write-host $max.Id $proj.ProjectName $maxFirstVersion; Update-Package -Id $max.Id -ProjectName $proj.ProjectName -Version $maxFirstVersion } }
@amccool
amccool / vnextbuilds.ps1
Last active June 20, 2017 17:48
getting build artifacts
param (
[string]$tfsServer = "http://tfs:8080/tfs/DefaultCollection",
[string]$projectName = "projectname",
[string]$username = "domain\username",
[string]$password = "XXXX",
[string]$outputDirectory = "d:\temp",
[string]$apiVersion = "2.0"
)
$tfsUrl = $tfsServer + '/' + $projectName
#param (
# [string]$tfsServer = "http://tfs:8080/tfs/DefaultCollection",
# [string]$tfsLocation = "$\stuff\of\dreams",
# [string]$remoteFolder
#)
$clientDll = "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.Client.dll"
$versionControlClientDll = "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.VersionControl.Client.dll"
$versionControlCommonDll = "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.VersionControl.Common.dll"
$buildClientDLL = "C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.Build.Client.dll"