Skip to content

Instantly share code, notes, and snippets.

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

Chris S. yetanotherchris

🔏
;ÿÿÿÿrules
View GitHub Profile
Netmask Netmask (binary) CIDR Notes
_____________________________________________________________________________
255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr)
255.255.255.254 11111111.11111111.11111111.11111110 /31 Unuseable
255.255.255.252 11111111.11111111.11111111.11111100 /30 2 useable
255.255.255.248 11111111.11111111.11111111.11111000 /29 6 useable
255.255.255.240 11111111.11111111.11111111.11110000 /28 14 useable
255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable
255.255.255.192 11111111.11111111.11111111.11000000 /26 62 useable
255.255.255.128 11111111.11111111.11111111.10000000 /25 126 useable
@yetanotherchris
yetanotherchris / git-config.ps1
Created April 3, 2019 09:35
Set git to use a different email (per repository)
git config --local user.email "chrisTHISPARTISFAKEsmall+github@gmail.com"
@yetanotherchris
yetanotherchris / converting-to-net-core.md
Last active June 25, 2018 06:53
Notes on converting Roadkill wiki (MVC 3/4) to .net core (MVC 6)
  • 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 October 4, 2016 07:15
Template for the Jekyll blog posts
Published title author layout shortpost tags
2016-MM-DD
Title here
Chris S
post
true
tag1
tag2
@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 / powershell-cheatsheet.ps1
Last active March 22, 2021 15:04
Powershell cheatsheet
# 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 April 2, 2018 17:12
Git blackbelt commands
# 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 February 15, 2024 23:31
Oauth2 Explanation

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.