Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar
😮

Eric Hexter erichexter

😮
View GitHub Profile
@erichexter
erichexter / BadController.csx
Last active August 29, 2015 14:25
Example Of CQS to keep framework entry classes light.
namespace QS.Admin.Controllers
{
public class BusinessesController : CommandQueryControllerBase
{
private IRepository _repository;
public BusinessController(IRepository repository){
_repository=repository;
}
[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("https://s.ch9.ms/Events/Build/2016/rss?media=True&tag[0]=.net&tag[1]=application-insights&tag[2]=asp.net&tag[3]=azure&tag[4]=csharp&tag[5]=cordova&tag[6]=data&tag[7]=devops&tag[8]=diagnostics&tag[9]=internet-of-things&tag[10]=javascript&tag[11]=machine-learning&tag[12]=managed-languages&tag[13]=node.js&tag[14]=open-source&tag[15]=security&tag[16]=testing&tag[17]=typescript&tag[18]=visual-studio&tag[19]=visual-studio-code&tag[20]=web-platform"))
$a.rss.channel.item | foreach{
try{
$urlstring=$_."group"."content" | where-object type -eq "video/mp4" | select -ExpandProperty url | where {$_ -notlike "*_mid.mp4"} | select-object -first 1
$url = New-Object System.Uri($urlstring)
@erichexter
erichexter / Cleandisk.ps1
Created June 21, 2016 11:27
Free disk space on Windows dev server
$LowDisk = 0.20
$timestamp = get-date
$disk = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='C:'" | Select-Object Size,FreeSpace
$freespace= $disk.FreeSpace / $disk.Size
if($freespace -lt $LowDisk ){
$folders = @(
'C:\Octopus\Files',
iwr https://gist.githubusercontent.com/erichexter/fcebbea98fdacb75a36f8ae83425fe82/raw/installapps.ps1 -UseBasicParsing | iex
// ==UserScript==
// @name Refresh Queue page
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.quarterspot.net/Queues*
// @grant none
// ==/UserScript==
@erichexter
erichexter / brainstorming-docker-net.md
Last active October 4, 2016 13:42
proposed docker layering for legacy .net 4.xxx applications using octopus deploy

Container layering

# Name Description
1 WindowsServerCore Made and Versioned by Microsoft
2 App Dependencies IIS/Websockets/ARR/.Net 4.6/VSRuntime...ect - Made and versioned by [My Company] patched adhoc
3 Release Bits for Application Created as part of build process image per release/build.
4 Enviornment / Tenant specific Configuration Contains configuration files for that tenant release combination using octopus variable replacement - Created by Octopus Deploy (because this contains tenant configuration). It is not a onetime process but rather updated as we push out deployments.

Build/CI/Cd Pipeline

mkdir c:\temp
cd c:\temp
Invoke-WebRequest -UseBasicParsing http://packages.diladele.com/squid/3.5.22/squid.msi -OutFile c:\temp\squid.msi
.\squid.msi #need to automate this or use chocolatey.org
New-NetFirewallRule -Name Squid -DisplayName Squid -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3128
$subscriptions=Get-AzureRmSubscription | select-object SubscriptionId -Unique
$rg=@()
$subscriptions | % {$_; Set-AzureRmContext -SubscriptionId $_.SubscriptionId ; $rg += Get-AzureRmResourceGroup|select-object Resourc
eGroupName}
use master
go
declare @dbnames nvarchar(max)
declare @statement nvarchar(max)
set @dbnames = ''
set @statement = ''
select @dbnames = @dbnames + ',[' + name + ']' from sys.databases where name like 'qs_a%' or name like 'qs_int%' or name like 'qs_ui%'
if len(@dbnames) = 0
begin
print 'no databases to drop'
fill 1 8 34 1 8 34 stone_stairs 0
fill 1 24 24 1 24 24 stone_stairs 4
fill 2 5 15 2 5 15 spruce_stairs 0
fill 2 5 17 2 5 17 stone_stairs 0
fill 2 5 24 2 5 24 stone_stairs 0
fill 2 5 31 2 5 31 stone_stairs 0
fill 2 5 33 2 5 33 spruce_stairs 0
fill 2 8 34 2 8 34 stone_stairs 5
fill 2 9 32 2 9 32 spruce_stairs 0
fill 2 9 33 2 9 33 spruce_stairs 0