Skip to content

Instantly share code, notes, and snippets.

View jstangroome's full-sized avatar

Jason Stangroome jstangroome

View GitHub Profile
@jstangroome
jstangroome / regex.md
Last active August 29, 2015 13:56 — forked from aaronpowell/regex.md

So I really hate when people use Assert.IsTrue(a == b) as an assertion in a unit test (I blogged my rant) so I decided to find a way to easily convert large test files to be more normal.

Search Regex

You'll want to search with this:

Assert\.IsTrue\((?<Actual>.*)\s*==\s*(?<Expected>.*)\)
//or if your language doesn't support named captures use:
Assert\.IsTrue\((.*)\s*==\s*(.*)\)
@jstangroome
jstangroome / Remove-IgnorableXaml.ps1
Created February 12, 2014 07:50
A PowerShell script which removes all the unnecessary elements and attributes from a Team Build Process Template XAML file that have been added by the Workflow Designer. http://blog.stangroome.com/2014/02/12/effectively-comparing-team-build-process-templates/
#requires -version 3
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateScript({ $_ | Test-Path -PathType Leaf })]
[string]
$Path,
[string]
$Destination = $Path
@jstangroome
jstangroome / TeamBuildNumber.targets
Created February 14, 2014 22:32
An MSBuild targets file to retrieve the Team Build Number for TFS 2012. Just <Import> this targets file and specify DependsOnTargets="TeamBuildNumber" in your <Target>.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="TeamBuildNumber">
<GetTeamBuildNumber TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" ContinueOnError="true">
<Output TaskParameter="TeamBuildNumber" PropertyName="TF_BUILD_BUILDNUMBER" />
</GetTeamBuildNumber>
</Target>
Get-ChildItem -Filter *.csproj -Recurse |
Select-Xml -XPath //b:Reference -Namespace @{b='http://schemas.microsoft.com/developer/msbuild/2003'} |
Select-Object -Property Path,
@{ N='Include'; E={$_.Node.Include} },
@{ N='HintPath'; E={$_.Node.HintPath} } |
Where-Object {
$_.HintPath -ne $null -and
$_.Include -eq "My.Assembly.Name"
} |
Out-GridView
@jstangroome
jstangroome / bootstrap.sh
Last active August 29, 2015 14:01
Custom build nginx for AWS Ubuntu
#!/bin/bash
wget -O build-nginx.sh https://gist.githubusercontent.com/jstangroome/ef20019de051c969e92b/raw/build-nginx.sh
chmod u+rx build-nginx.sh
@jstangroome
jstangroome / gist:8ce1b162925cf8a54c07
Last active August 29, 2015 14:02
mco puppet runonce show_diff utf8 bug
#mcollective-puppet-agent 1.7.2 on agent, 1.7.0 on master
#mcollective 2.5.0 on master
#puppet 3.6.2 on agent, 3.4.3 on master
#ruby 1.9.3p484 on agent, 1.8.7 on master
#ubuntu 14.04 on agent, 12.04 on master
# reproducible with `mco puppet runonce` on master, or `sudo LANG=C LC_ALL=C puppet agent --show_diff` on agentDebug: Executing 'diff -u /var
# workaround in puppet: file { 'blah': show_diff => false }
@jstangroome
jstangroome / facter-ec2-2.0.2.patch
Created June 24, 2014 01:59
Include EC2 metadata in facter 2.0.2 facts
--- ec2.rb.bak 2014-06-24 01:48:07.461985136 +0000
+++ ec2.rb 2014-06-24 01:48:52.548889032 +0000
@@ -28,8 +28,7 @@
end
end
-if (Facter::Util::EC2.has_euca_mac? || Facter::Util::EC2.has_openstack_mac? ||
- Facter::Util::EC2.has_ec2_arp?) && Facter::Util::EC2.can_connect?
+if Facter::Util::EC2.can_connect?
metadata
@jstangroome
jstangroome / dpkg.get-selections.out
Created September 2, 2014 01:09
Default list of packages installed in ami-83dabdb9, ie ubuntu/images/ebs-ssd/ubuntu-trusty-14.04-amd64-server-20140607.1
accountsservice install
acpid install
adduser install
apparmor install
apport install
apport-symptoms install
apt install
apt-transport-https install
apt-utils install
apt-xapian-index install
@jstangroome
jstangroome / dpkg.get-selections.out
Created September 8, 2014 23:32
Default list of packages installed in Docker Image ubuntu:14.04.1. `sudo docker run ubuntu:14.04.1 /usr/bin/dpkg --get-selections`
adduser install
apt install
apt-utils install
base-files install
base-passwd install
bash install
bsdutils install
busybox-initramfs install
bzip2 install
console-setup install
[ಠ_ಠ]
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ಠ_ಠAttribute : Attribute
{
public ILog Log { get; set; }
public ಠ_ಠAttribute()
{
Log.Info("This code is bad and you should feel bad");
}