Skip to content

Instantly share code, notes, and snippets.

View erichexter's full-sized avatar

Eric Hexter erichexter

View GitHub Profile
@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',
[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 / 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;
}
@erichexter
erichexter / gist:8f7c6b1d21102b2234a9
Created March 19, 2015 13:38
calling chrome with a new instance to stream to multiple chrome-casts simultaneously.
use the user-data-dir to create a new instance of chrome that will can stream to a chromecast, once you start up this instance the first time, you need to install the chromecast extension.
Launch this app and then start casting.
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\temp\chrome1 url
[Test]
[TestCaseSource("DocumentContent")]
public void Every_Content_type_Should_have_A_categorizer(string documentContentType)
{
allTypes.Any(s => s.Name.Contains(documentContentType + "DocumentContentCategorizer")).ShouldBeTrue(String.Format("{0} does not have a DocumentContentCategorizer.", documentContentType));
}
DocumentContent = Enum.GetNames(typeof(DocumentContent));
@erichexter
erichexter / Retry.cs
Last active August 29, 2015 14:17 — forked from plioi/Retry.cs
public class IntegrationTestConvention : Convention
{
public IntegrationTestConvention()
{
Classes
.NameEndsWith("Tests");
Methods
.Where(method => method.IsVoid() || method.IsAsync());
@erichexter
erichexter / GitPullAll.ps1
Created March 10, 2015 14:28
Update All Local Branches
git branch | %{ git checkout $_.Trim().Replace("* ","");git pull}
cinst 1password
cinst 7zip
cinst 7zip.install
cinst adobereader
cinst autohotkey.portable
cinst beyondcompare
cinst DotNet4.5.1
cinst fiddler4
cinst WindowsLiveWriter
cinst githubforwindows
@erichexter
erichexter / Webserver.js
Created November 24, 2014 19:54
Optimal Dev Ops Description
{
WindowsFeaturesInstalled: ["IIS-WebServerRole",""]
WindowsFeaturesRemoved: ["",""]
ChocolateyPakagesInstall: ["git","chrome"]
ChocolateyPakagesRemoved: ["",""]
CertificatesInstall: ["",""]
CertificateRemoved: ["",""]
PowershellScripts:[ "configuremachine.ps1;install-agent" ]
}
@erichexter
erichexter / program.cs
Created October 22, 2014 19:58
send SQL AZURE Performance Data to TelemetryApp.com
void Main()
{
do{
try{
var context=new QsContext();
var connection=context.Database.Connection as SqlConnection;
List<dynamic> results= new List<dynamic>();
SqlCommand command = new SqlCommand("SELECT top 1 * FROM sys.dm_db_resource_stats order by end_Time desc",connection);