Skip to content

Instantly share code, notes, and snippets.

View ploegert's full-sized avatar
💭
¯\_(ツ)_/¯

Justin Ploegert ploegert

💭
¯\_(ツ)_/¯
View GitHub Profile
@ploegert
ploegert / certs.sh
Last active February 17, 2023 20:26 — forked from joakinen/certs.sh
Converting certificates
#!/bin/sh
#Generate & Export to PFX
openssl version -a
$name = "test"
$key = "$name.key"
$crt = "$name.crt"
$pfx = "$name.pfx"
@ploegert
ploegert / OIDC and OAuth2 Flows.md
Created March 21, 2017 17:11 — forked from jawadatgithub/OIDC and OAuth2 Flows.md
Enrich IdentityServer3 Documentation with OIDC (OpenID Connect) and OAuth2 Flows section
Note for community:

A. IdentityServer3 docs, samples and source code use OIDC & OAuth2 terms interchangeably to refer to same thing in many areas. I think that's make sense because OIDC introduced as complement & extension for OAuth2.

B. IdentityServer3, STS, OP, OIDC server, OAuth2 server, CSP, IDP and others: means same thing (software that provide/issue tokens to clients) as explained in [Terminology] (http://identityserver.github.io/Documentation/docs/overview/terminology.html).

C. Grants and flows mean same thing, grant was the common term in OAuth2 specs and flow is the common term in OIDC specs.

D. This document will not focus on custom flow/grant.

E. [Important] Choosing wrong flow leads to security threat.

@ploegert
ploegert / Run-AsAdmin.ps1
Created September 12, 2016 17:20
Powershell Run as Admin
# Get the ID and security principal of the current user account
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent();
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID);
# Get the security principal for the administrator role
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator;
# Check to see if we are currently running as an administrator
if ($myWindowsPrincipal.IsInRole($adminRole))
{
@ploegert
ploegert / Setup-PoshProfile.ps1
Created September 12, 2016 16:28
Setup Powershell Profile
cd $env:USERPROFILE\Documents
md WindowsPowerShell -ErrorAction SilentlyContinue
cd WindowsPowerShell
if (-not (test-path ".\Microsoft.PowerShell_profile.ps1"))
{ new-item -ItemType File -Name Microsoft.PowerShell_profile.ps1 -ErrorAction SilentlyContinue }
#powershell_ise.exe .\Microsoft.PowerShell_profile.ps1
start "C:\Program Files (x86)\Microsoft VS Code\Code.exe" ".\Microsoft.PowerShell_profile.ps1"
@ploegert
ploegert / Mount-SerialPort-MacOSx.sh
Created March 14, 2016 20:01
MacOS command to mount a serial port
flashing on mac:
#get list of devices connected
ls -l /dev/cu*usb*
ls -l /dev/tty*usb*
#Get Terminal output
sudo cu -l ls -l /dev/cu*usb* -s 115200
#Reset DSC
function Flush-DSCConfig
{
#List current DSC Docs:
Get-ChildItem -Path 'C:\Windows\System32\Configuration' -File -Force
#Remove All Docs:
Remove-DscConfigurationDocument -Stage Current, Pending, Previous -Verbose
@ploegert
ploegert / write-log.ps1
Created February 3, 2016 18:58
write log for powershell
function Write-Log
{
param([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)][AllowEmptyString()][string]$Message)
Write-Verbose -Verbose ("[{0:s}] {1}`r`n" -f (get-date), $Message)
}
@ploegert
ploegert / Configure-CapacityMetrics.ps1
Created January 27, 2016 17:50 — forked from RichardSlater/Configure-CapacityMetrics.ps1
Retrieve the latest storage capacity metrics for multiple storage accounts and display in a range of units.
# *************************************************************************************************
# * Configure-CapacityMetrics *
# *************************************************************************************************
# * Description: Configures Capacity metrics *
# * Author: Richard Slater <[email protected]> *
# * Date: 2013.02.02 *
# * Prerequisites: WAPPSCmdlets (https://www.windowsazure.com/en-us/manage/downloads/) *
# *************************************************************************************************
Set-StorageServicePropertiesForAnalytics -ServiceName "Blob" -StorageAccountName "<Storage Account Name>" -StorageAccountKey "<Storage Account Key>" -MetricsEnabled -MetricsRetentionPolicyDays 7 -MetricsRetentionPolicyEnabl
@ploegert
ploegert / Posh-Packagemgmt.ps1
Created January 26, 2016 16:12
Package Repos
#Reference Site:
#http://learn-powershell.net/2014/04/03/checking-out-oneget-in-powershell-v5/
#Show List of what commands are possible
get-command -module PackageManagement
<#
CommandType Name Version Source
@ploegert
ploegert / Connect-WinRM.ps1
Created January 25, 2016 15:45
Connect to remote host
function Write-Log
{
param([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)][AllowEmptyString()][string]$Message)
Write-Verbose -Verbose ("[{0:s}] {1}`r`n" -f (get-date), $Message)
}
$destHost="10.9.13.21"
$user = "administrator"
$pass = ConvertTo-SecureString -String "PASSWORD" -AsPlainText -Force