Skip to content

Instantly share code, notes, and snippets.

Scott Hanselman shanselman

Block or report user

Report or block shanselman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2f2cbf19c196c46021ba3f09ca5c1ae8
<rewrite>
<rewriteMaps configSource="rewritemaps.config" />
<rules>
<rule name="Redirect Rule" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<add input="{StaticRedirects:{URL}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
</rule>
View profile.json
{
"defaultProfile": "{79285a8e-036c-446f-8a9c-78994e34bf85}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"showTabsInTitlebar": true,
"requestedTheme": "dark",
"profiles": [
{
@shanselman
shanselman / profile.json
Created May 7, 2019
Windows Terminal Profile
View profile.json
{
"defaultProfile": "{7d04ce37-c00f-43ac-ba47-992cb1393215}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"experimental_showTabsInTitlebar": true,
"requestedTheme": "dark",
"profiles": [
{
View gist:8f3dac3171fc4b9bcde334d3cdc99d3b
RED="$(tput setaf 1 2>/dev/null || echo '')"
GREEN="$(tput setaf 2 2>/dev/null || echo '')"
YELLOW="$(tput setaf 3 2>/dev/null || echo '')"
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
function __ps1_bgl {
eval "$(cat /mnt/c/Users/scott/.bgl-cache)"
local trend="?"
case "${nightscout_trend}" in
@shanselman
shanselman / addVSVarsToPowerShell
Created Dec 11, 2018
PowerShell Profile addition to take VSVars and make it automatic in PS1
View addVSVarsToPowerShell
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow
View fibb.cs
using System.Collections.Generic;
namespace FibonacciTest
{
public static class FibonacciGenerator
{
public static IEnumerable<int> Fibonacci()
{
int current = 1, next = 1;
while (true)
@shanselman
shanselman / removeNetCorePreviews.ps1
Created Mar 3, 2018
Remove .NET Core ASK Previews - Run as admin
View removeNetCorePreviews.ps1
$choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription]
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes'))
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&No'))
Get-WmiObject Win32_Product -filter "name LIKE '%Preview%' AND name LIKE '%SDK%'" | ForEach-Object {
$message = "ZOMG"
$question = "Uninstall " + $_.Name + "?"
$decision = $Host.UI.PromptForChoice($message, $question, $choices, 0)
if($decision -eq 0) {
$_.Uninstall()
@shanselman
shanselman / aspnetcore.yml
Created Oct 31, 2017
Basic ASP.NET Core YAML
View aspnetcore.yml
---
apiVersion: v1
kind: Service
metadata:
name: aspnetcoreapp
labels:
app: aspnetcoreapp
spec:
type: NodePort
ports:
@shanselman
shanselman / Dockerfile
Last active Aug 24, 2019
Smarter ASP.NET Core Docker File
View Dockerfile
FROM microsoft/dotnet:2.0-sdk as builder
RUN mkdir -p /root/src/app/aspnetcoreapp
WORKDIR /root/src/app/aspnetcoreapp
#copy just the project file over
# this prevents additional extraneous restores
# and allows us to resuse the intermediate layer
# This only happens again if we change the csproj.
# This means WAY faster builds!
@shanselman
shanselman / k8s-pi.md
Last active Sep 4, 2019 — forked from alexellis/k8s-pi.md
K8s on Raspbian
View k8s-pi.md

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

You can’t perform that action at this time.