Skip to content

Instantly share code, notes, and snippets.

View yetanotherchris's full-sized avatar
🔏
;ÿÿÿÿrules

Chris S. yetanotherchris

🔏
;ÿÿÿÿrules
View GitHub Profile
@yetanotherchris
yetanotherchris / setup-script-windows-10.ps1
Last active February 4, 2024 14:03
Setup script for Windows 10
# Rin this script: iex ((new-object net.webclient).DownloadString("https://gist.githubusercontent.com/yetanotherchris/675e6d1ad0c8ee5875ee311a80139f70/raw/020e3eecf125d9320bd480f0da10e0cd02a1981e/setup-script-windows-10.ps1"))
Set-ExecutionPolicy Unrestricted
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# stop the -y flag being needed for all "choco install"s
choco feature enable --name allowGlobalConfirmation
Write-Host "================================================" -ForegroundColor Green
Write-Host "Installing normal guy software" -ForegroundColor Green
@yetanotherchris
yetanotherchris / better-powershell.prompt.ps1
Created January 2, 2016 21:50
A powershell prompt that shows the current directory only, based off http://ss64.com/ps/syntax-prompt.html
function prompt { ($pwd -split '\\')[0]+'...'+$(($pwd -split '\\')[-1] -join '\') + '> ' }
@yetanotherchris
yetanotherchris / install.ps1
Last active February 4, 2024 14:02
Setup script for a new PC/laptop, once all the bloatware has been removed
# Launch Powershell as admin
Set-ExecutionPolicy RemoteSigned -Confirm:$false -Force
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Stop prompting in Choclately
choco feature enable -n allowGlobalConfirmation
choco install googlechrome
choco install firefox
choco install coneumu
@yetanotherchris
yetanotherchris / acl.ps1
Created November 15, 2016 12:00
Set write permissions on a directory in Powershell for IIS
$acl = Get-Acl "C:\Windows\Temp"
$rule = New-Object System.Security.Accesscontrol.FileSystemAccessRule("IIS_IUSRS","Write","Allow")
$acl.SetAccessRule($rule)
Set-Acl "C:\Windows\Temp" $acl
@yetanotherchris
yetanotherchris / in-memory-http-server.cs
Last active February 4, 2024 14:00
In memory http server for C# unit and integration tests
public static Task BasicHttpServer(string url, string outputHtml)
{
return Task.Run(() =>
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add(url);
listener.Start();
// GetContext method blocks while waiting for a request.
HttpListenerContext context = listener.GetContext();
@yetanotherchris
yetanotherchris / enable-iis-windows-10.ps1
Created May 21, 2016 17:36
Powershell script to enable all IIS, MSMQ and WCF features on Windows 8 and 10.
Import-Module Dism
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
@yetanotherchris
yetanotherchris / vue-js-net-core.md
Last active December 21, 2023 18:18
Vue JS with ASP.NET Core - basic example

Vue JS with ASP.NET Core

These notes come with much appreciation from Packt's ASP.NET Core 2 and Vue.js, adapted for my use.

.NET Core currently (2.2) only ships with a React and Angular project template. There is a Vue one but it uses Typescript and for some unknown reason doesn't compile when you perform a "dotnet run".

Install the dotnet template

  • dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
  • dotnet new vue
@yetanotherchris
yetanotherchris / appsettings.json
Last active September 28, 2023 08:32
.NET Core Examples: configuration binding and appsetting.json
{
"Smtp": {
"Host": "smtp.gmail.com",
"Port": 587,
"UseSSL": true,
"Username": "bob",
"Password": "password",
}
}
public class HashEncryption
{
/// <summary>
/// Encrypts a string using the MD5 hash encryption algorithm.
/// Message Digest is 128-bit and is commonly used to verify data, by checking
/// the 'MD5 checksum' of the data. Information on MD5 can be found at:
///
/// http://www.faqs.org/rfcs/rfc1321.html
/// </summary>
/// <param name="Data">A string containing the data to encrypt.</param>
@yetanotherchris
yetanotherchris / install-rabbitmq.sh
Last active April 29, 2023 07:10
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq