Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar
😮

Eric Hexter erichexter

😮
View GitHub Profile
// ==UserScript==
// @name Remove Left Nav Items
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match https://manage.windowsazure.com/*
// @grant unsafeWindow
// ==/UserScript==
@erichexter
erichexter / gist:b0cca2ff2e3ab120cec8
Created August 14, 2014 15:28
Install octopus agent using a winRM / remote powershell session
function bootstrap-tentacle{
param($username,$password,$environments,$roles)
$rolestring="@(""" + ($roles -join """,""") + """)"
$environmentstring="@(""" + ($environments -join """,""") + """)"
$command = ". c:\redist\configuremachine.ps1;install-tentacle -environments $environmentstring -roles $rolestring"
$command | set-content c:\installoctopus.ps1
Write-Host "Starting Tentacle install script:"
New-Landlord [filepath]
Remove-Landlord [filepath]
@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
}
}
@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))
{
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 / 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()
@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 / 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 / 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);