Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar
😮

Eric Hexter erichexter

😮
View GitHub Profile
#install-package Microsoft.Web.Xdt -Prerelease
var doc = new XmlTransformableDocument();
doc.Load(@"..\..\..\www\web.config");
var t = new XmlTransformation(@"..\..\..\www\web.ci.config");
if (t.Apply(doc))
{
doc.Save("foobar.xml");
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
cinst hexter.octopus
"c:\Program Files (x86)\Octopus\Tools\Tools.exe"
@erichexter
erichexter / download.ps1
Last active December 18, 2015 02:18
Download the Microsoft Build 2013 videos - Just the Developer Videos
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
#$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/rss/mp4high/?sort=sequential&direction=desc&term=&r=Developer+Tools+%26+Application+Lifecycle+Management&r=Windows+Azure+Application+Development&y=Breakout&Media=true#fbid=FDnmapgI5Hf
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/RSS/mp4high
#http://channel9.msdn.com/Events/Build/2013/RSS/mp4high#theSessions
#http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/rss/mp4high/?sort=sequential&direction=desc&term=&r=Developer+Tools+%26+Application+Lifecycle+Management&r=Windows+Azure+Application+Development&y=Breakout&Media=true#fbid=FDnmapgI5Hf
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2013/RSS/mp4high#theSessions"))
$a.rss.channel.item | foreach{
@erichexter
erichexter / LoggingStopwatch.cs
Last active December 19, 2015 08:18
a timing api to log api calls to system trace. this is useful in windows azure website, since you can stream trace information from the infrastructure when you need to diagnose.
public class LoggingStopwatch : IDisposable
{
private readonly string _operationname;
private Stopwatch stopwatch;
public LoggingStopwatch(string operationname)
{
_operationname = operationname;
stopwatch = new Stopwatch();
System.Diagnostics.Trace.WriteLine("Starting tracing of "+ operationname);
@erichexter
erichexter / Start-IIS.ps1
Created July 10, 2013 02:54
Solution script to start up iis on a webproject
#start iis with the console window up, so we can see trace messages from the website while were doing front end development.
function global:start-iis(){
param($port="14062",$wwwdir="website")
$websitepath=$dte.solution.FileName | split-path | join-path -childpath $wwwdir
&start 'C:\Program Files (x86)\IIS Express\iisexpress.exe' "/trace:none /path:$websitepath /port:$port"
}
@erichexter
erichexter / upsize-buildserver.ps1
Created July 12, 2013 00:53
People ask me why I like azure so much.. its the ISP/hoster I always wanted... here is my script for upsizing my build server....
get-azurevm -name qsvmdvb1 -ServiceName qsvmdvb2|set-azurevmsize -InstanceSize Medium|update-azurevm
@erichexter
erichexter / PostDeploy.ps1
Created September 16, 2013 18:05
Encrypt Configuration Settings from octopus deploy postdeploy.ps1
$p = join-path . ".\CommandProcessor.exe" -Resolve
$c =[System.Configuration.ConfigurationManager]::OpenExeConfiguration($p)
$s=$c.GetSection("connectionStrings")
$s.SectionInformation.ProtectSection($null)
$s=$c.GetSection("appSettings")
$s.SectionInformation.ProtectSection($null)
$c.Save()
Write-Host "Installing foobar for $Environment"
& .\QS.CommandProcessor.exe install -instance:$Environment | Write-Host
do
{
Write-Host "Starting Command Processor for $Environment"
& .\QS.CommandProcessor.exe start -instance:$Environment | Write-Host
start-sleep 5
$service = Get-Service "QSCommandProcessor`$$Environment" -ErrorAction SilentlyContinue
@erichexter
erichexter / downloadWebBuildVideos.ps1
Last active August 29, 2015 13:58
Download Build 2014 videos - for web developers
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
#$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$a = ([xml]$rss.downloadstring("http://s.ch9.ms/Events/Build/2014/rss/mp4high?sort=sequential&direction=desc&term=&tag=asp.net&tag=azure&Media=true"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-") + ".mp4"
if (!(test-path $file))
{
@erichexter
erichexter / landlord.ps1
Created April 17, 2014 12:20
Landlord windows environment configuration
for($i=0;$i -lt 2;$i++){
Machine Web$i {
Add-WindowsFeature Net-Framework
Probision base.ps1
Provision webserver.ps1
Provision octopus.ps1 www development
}
}