Skip to content

Instantly share code, notes, and snippets.

@benhysell
benhysell / applyImage.ps
Last active December 19, 2018 18:16
Create WindowsToGo with UEFI Boot Only
#note - may have to run diskpart script by itself
.\diskpart.exe /s "C:\diskpartScript.txt"
dism /apply-image /imagefile:"Z:\Path to WIM\win10Ann.wim" /index:1 /applydir:W:\
bcdboot W:\Windows /s S: /f UEFI
@benhysell
benhysell / script.js
Last active January 24, 2017 01:52
Five Week Interval
/**
* A special function that runs when the spreadsheet is open, used to add a
* custom menu to the spreadsheet.
*/
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [
{name: 'Five Week Interval Report...', functionName: 'generateFiveWeekIntervalReport'}
];
spreadsheet.addMenu('Reports', menuItems);
@benhysell
benhysell / script.js
Last active May 24, 2018 13:36
Google Sheets Script For Creating Reports
/**
* A special function that runs when the spreadsheet is open, used to add a
* custom menu to the spreadsheet.
*/
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [
{name: 'Generate Academic Status Report...', functionName: 'generateAcademicStatusReport'}
];
spreadsheet.addMenu('Reports', menuItems);
@benhysell
benhysell / BaseTest.cs
Created November 21, 2016 19:36
Entity Famework Core In Memory Database Unit Testing Named Databases
[TestClass]
public class BaseTest
{
public TestContext TestContext { get; set; }
public static IServiceProvider ServiceProvider;
[TestInitialize]
public virtual void SetUp()
{
//ensure each unit test gets a fresh database
@benhysell
benhysell / SiteControl.ps1
Last active January 13, 2017 19:44
Start/stop IIS from powershell
Param([string] $siteName, [bool] $up)
Import-Module WebAdministration
if($up)
{
#website
Start-WebSite $siteName
#worker
Start-WebAppPool $siteName
}
else
@benhysell
benhysell / Set-BuildVersion.ps1
Last active November 8, 2016 14:43
set build version asp.net core project.json file
Param(
[string] $filePath,
[string] $buildNumber
)
$jsonContent = Get-Content $filePath -Raw | ConvertFrom-Json
$jsonContent.version = $jsonContent.version + "." + $buildNumber
ConvertTo-Json -InputObject $jsonContent -Depth 20 | Set-Content $filePath
@benhysell
benhysell / CompareSnippet.cs
Created September 7, 2016 13:36
Compare .NET objects
#if DEBUG
var compareLogic = new CompareLogic(new ComparisonConfig() { MaxDifferences = 100 });
var result = compareLogic.Compare(workstation, workstationOld);
//if these are different, write out the differences
if (!result.AreEqual)
Console.WriteLine(result.DifferencesString);
#endif
@benhysell
benhysell / MainView.xaml
Created August 30, 2016 19:52
MvvmCross WPF Menu Item Shortcut Key Binding
<views:BaseView x:Class="MyCoolApplication.Wpf.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:MyCoolApplication.Wpf.Views"
xmlns:mvx="clr-namespace:MvvmCross.BindingEx.WindowsPhone;assembly=MvvmCross.BindingEx.Wpf"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" >
<Grid>
@benhysell
benhysell / project.json
Created August 16, 2016 14:33
.net core copy to output
"buildOptions": {
"copyToOutput": "appsettings.json"
}
@benhysell
benhysell / AdamAnalysisJob.cs
Created November 25, 2015 14:28
TopShelf Service with Hangfire, Enterprise Library IOC, and SignalR reporting back to a website using Redis
namespace V.AdamAnalysis.BusinessLogic.Jobs
{
public class AdamAnalysisJob
{
//none of the real work is shown here...the interesting parts are the constructors that take in objects to be used
//and the journal mechansim to report progress back to the website.
private AdamAnalysisManager adamAnalysisManager;
private IHubContext hubContext;