Skip to content

Instantly share code, notes, and snippets.

@hbulens
hbulens / install-sqlserverexpress.ps1
Created Jun 16, 2021
Installs SQL Server Express 2019
View install-sqlserverexpress.ps1
function Install-SQLServerExpress2019 {
Write-Host "Downloading SQL Server Express 2019..."
$Path = $env:TEMP
$Installer = "SQL2019-SSEI-Expr.exe"
$URL = "https://go.microsoft.com/fwlink/?linkid=866658"
Invoke-WebRequest $URL -OutFile $Path\$Installer
Write-Host "Installing SQL Server Express..."
Start-Process -FilePath $Path\$Installer -Args "/ACTION=INSTALL /IACCEPTSQLSERVERLICENSETERMS /QUIET" -Verb RunAs -Wait
Remove-Item $Path\$Installer
@hbulens
hbulens / install-azure-ad-app.ps1
Last active May 10, 2021
Create an Azure AD App with application permissions using PowerShell. Courtesy of https://stackoverflow.com/a/61458391/1842261
View install-azure-ad-app.ps1
param (
[Parameter(mandatory = $false, HelpMessage = "The name of the Azure AD App.")]
[string] $appName = "dime-scheduler",
[Parameter(mandatory = $true, HelpMessage = "The id of the Azure tenant ")]
[string] $tenantId,
[Parameter(mandatory = $true, HelpMessage = "The name of the Azure tenant ")]
[string] $tenantName,
View get-ds-logs.ps1
param (
[Parameter(mandatory = $false, HelpMessage = "The name of the Azure AD App.")]
[string] $appName = "dime-scheduler",
[Parameter(mandatory = $true, HelpMessage = "The id of the Azure tenant ")]
[string] $tenantId,
[Parameter(mandatory = $true, HelpMessage = "The name of the Azure tenant ")]
[string] $tenantName,
View 2016-05-29-working-with-files-with-powershell_008.ps1
Get-ChildItem .\ -include bin,obj -Recurse | foreach { remove-item $_.fullname -Force -Recurse }
View azure-pipelines.yaml
# Node.js
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
View resources-to-javascript-008.cs
public class ResourcesHelper
{
private readonly IStringLocalizerFactory _stringLocalizerFactory;
public ResourcesHelper(IStringLocalizerFactory stringLocalizerFactory)
{
_stringLocalizerFactory = stringLocalizerFactory;
}
public IEnumerable<LocalizedString> GetResources(string name)
View resources-to-javascript-007.cs
internal class ResourceGroup
{
public string Name { get; set; }
public IEnumerable<LocalizedString> Entries { get; set; }
}
View resources-to-javascript-006.cs
internal static class ResourceGroupExtensions
{
/// <summary>
/// Converts the source data to a Javascript variable
/// </summary>
/// <param name="resources">The record to convert</param>
/// <returns>A valid Javascript object</returns>
internal static string ToJavascript(this IEnumerable<ResourceGroup> resources)
{
StringBuilder sb = new StringBuilder();
View resources-to-javascript-005.cs
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Localization;
using System.Linq;
using System.Reflection;
namespace InjectJavascriptToWebApp
{