Skip to content

Instantly share code, notes, and snippets.

View abombss's full-sized avatar

Adam Tybor abombss

  • Accenture
  • Chicago, IL
View GitHub Profile
@abombss
abombss / ReflectOverAssemblyAttributes.cs
Last active August 22, 2016 15:21
Collect all assembly attributes using a reflection only load of an assembly
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security.Policy;
namespace MsBuild.AssemblyFu
{
internal interface IAssemblyAttributeGetter
@abombss
abombss / DumpItems.xml
Created March 20, 2013 23:54
Dump ItemGroups and metadata from msbuild
<!--?xml version="1.0" encoding="utf-8"?-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
TaskName="LogItems"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<Items Required="true" ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
<Metadata ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
<Importance />
@abombss
abombss / Add-GitIgnore.ps1
Last active December 15, 2015 11:49
Add-GitIgnore
function Add-GitIgnoreForVS ([switch]$DisableNugetRestore,[switch]$PassThru) {
$cmdArgs = @{
Name="VisualStudio"
PassThru=$PassThru
Uncomment=( & {if($DisableNugetRestore) { @() } else { @("packages/") } })
}
Add-GitIgnore @cmdArgs
}
function Add-GitIgnore ([string]$Name, [switch]$PassThru, [string]$UserRepo="github/gitignore", [string]$Branch="master", [string[]]$Uncomment) {
@abombss
abombss / sample.ps1
Created April 18, 2013 07:49
TFS and Powershell
# Load some types initially so the cmdlets work
Add-TFSApiAssembly
# Create a TFS TeamProjectCollection and extend it with some common service properties for easy access
$tfs = Get-Tfs -Uri https://tfs.somedomain.com/tfs/ProjectCollection -Services BS, VCS, TM -Verbose
# You can write cmdlets or you can use the built in API and add your own extensions
$buildDefinitions = Get-TfsBuildDefinition -Tfs $tfs -TeamProject MyProject
# $buildDefinitions = $tfs.BS.QueryBuildDefinitions('MyProject')
@abombss
abombss / MyHttpWebRequest.cs
Created May 16, 2013 16:34
Inherit from HttpWebRequest... pure evil will ensue.
public class MyHttpWebRequest : HttpWebRequest
{
private static readonly IFormatterConverter Converter = new FormatterConverter();
private static readonly StreamingContext Context = new StreamingContext(StreamingContextStates.Clone);
public MyHttpWebRequest(string url)
: this(new Uri(url))
{
}
@abombss
abombss / TraceSourceList.md
Last active December 17, 2015 17:18
Some .net diagnostic TraceSources

List of Trace Sources in some .Net Assemblies

  • System.Net
  • System.Net.Http
  • System.Net.Sockets
  • System.Net.Cache
  • System.Net.WebSockets
  • System.Net.HttpListener
  • System.Runtime.Serialization.CodeGeneration
  • System.Security.Cryptography.Xml.SignedXml
@abombss
abombss / JoinItems.tasks.targets
Created May 30, 2013 08:20
MSBuild Join Items Task
<UsingTask
TaskName="JoinItems"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<OuterItems ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OuterProperty Required="false" ParameterType="System.String" />
<InnerItems ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<InnerProperty Required="false" ParameterType="System.String" />
<IgnoreCase Required="false" ParameterType="System.String" />
@abombss
abombss / Add-ServerFarm.ps1
Created June 13, 2013 18:47
Make configuring an IIS Server Farm easier
function Add-ServerFarm {
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory=$true)]
[string]$Name,
[Parameter(Mandatory=$true)]
[string[]]$Servers,
@abombss
abombss / NServiceBus.Override.cs
Last active January 1, 2016 13:59
NServiceBus.Override to easily override configuration sections, and sources at runtime.
#region Copyright
//The MIT License (MIT)
//
//Copyright (c) 2013 Adam Tybor ([email protected])
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
@abombss
abombss / SumoApi.ps1
Created November 26, 2014 17:39
SumoLogic Powershell API
<#
The MIT License (MIT)
Copyright (c) 2014 Adam Tybor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is