Skip to content

Instantly share code, notes, and snippets.

📈
Focusing

Chris S. yetanotherchris

📈
Focusing
Block or report user

Report or block yetanotherchris

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
@yetanotherchris
yetanotherchris / git-config.ps1
Created Apr 3, 2019
Set git to use a different email (per repository)
View git-config.ps1
git config --local user.email "chrisTHISPARTISFAKEsmall+github@gmail.com"
@yetanotherchris
yetanotherchris / converting-to-net-core.md
Last active Jun 25, 2018
Notes on converting Roadkill wiki (MVC 3/4) to .net core (MVC 6)
View converting-to-net-core.md
  • RedirectToRouteResult is now RedirectToActionResult, with an ActionName property
  • No System.Runtime.Caching - replace it with IMemoryCache (Microsoft.Extensions.Caching.Memory)
  • typeof(x).Assembly is now typeof(x).GetTypeInfo().Assembly
  • MongoCollection has changed
  • StringComparison.InvariantCultureIgnoreCase is gone, easy replacement
  • Configuration + Sections are totally different
  • HttpContext and HttpRequest etc. now found in Microsoft.AspNetCore.Http.Abstractions - Microsoft.AspNetCore.Http.HttpRequest
  • Request.RequestUri is now various new properties, for example Request.Host (a HostString)
  • WebActivatorEx?
  • DependencyResolver?
@yetanotherchris
yetanotherchris / jekyll-blogpost-template.md
Last active Oct 4, 2016
Template for the Jekyll blog posts
View jekyll-blogpost-template.md
Published title author layout shortpost tags
2016-MM-DD
Title here
Chris S
post
true
tag1
tag2
@yetanotherchris
yetanotherchris / install.ps1
Last active Nov 11, 2018
Setup script for a new PC/laptop, once all the bloatware has been removed
View install.ps1
# 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
View powershell-cheatsheet.ps1
# Using properties inside strings
$now = get-date
$shortId = "$($now.Millisecond)$($now.Day)$($now.Month)"
# Parameters, eg .\myscript.ps1 -arg1 value1 -arg2 value2 -force
param (
[Parameter(Mandatory=$true)]
[string]
$arg1 = "defaultvalue",
[string] $arg2 = $(throw "-arg2 is required."),
@yetanotherchris
yetanotherchris / git-cheatsheet.ps1
Last active Apr 2, 2018
Git blackbelt commands
View git-cheatsheet.ps1
# Change the config editor to notepad
git config --global core.editor notepad
# ...and then edit the config
git config --global --edit
# Revert master back by 5 commits
git revert --no-commit HEAD~5..
# Revert master back by 5, but do it so there you get a "Revert commit" for each commit you reverted (this opens Vim)
@mziwisky
mziwisky / Oauth2.md
Last active Aug 5, 2019
Oauth2 Explanation
View Oauth2.md

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

You can’t perform that action at this time.