Skip to content

Instantly share code, notes, and snippets.

View shanselman's full-sized avatar

Scott Hanselman shanselman

View GitHub Profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@shanselman
shanselman / gist:5422230
Last active July 26, 2024 02:53
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@shanselman
shanselman / gist:5191659
Last active July 26, 2024 02:44
Sendy web.config for running on the root of a site on Windows or Azure
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Sendy all" stopProcessing="true">
<match url="^([a-zA-Z0-9-]+)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
@shanselman
shanselman / aspnetcore.yml
Created October 31, 2017 17:00
Basic ASP.NET Core YAML
---
apiVersion: v1
kind: Service
metadata:
name: aspnetcoreapp
labels:
app: aspnetcoreapp
spec:
type: NodePort
ports:
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
{
"defaultProfile": "{79285a8e-036c-446f-8a9c-78994e34bf85}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"showTabsInTitlebar": true,
"requestedTheme": "dark",
"profiles": [
{
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"copyOnSelect": false,
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
@shanselman
shanselman / setupmachine.bat
Last active June 14, 2024 12:59
WinGet Setup a New Machine
mkdir c:\github
winget install --id=Git.Git -e --accept-package-agreements --accept-source-agreements
winget install --id=Microsoft.VisualStudioCode -e
winget install --id=AgileBits.1Password -e
winget install --id=7zip.7zip -e
winget install --id=Twilio.Authy -e
winget install --id=Bethesda.Launcher -e
winget install --id=Microsoft.Bicep -e
winget install --id=Microsoft.bitsmanager -e
winget install --id=BrutalChess.BrutalChess -e
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
@shanselman
shanselman / Dockerfile
Last active November 10, 2023 19:17
Smarter ASP.NET Core Docker File
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!