Skip to content

Instantly share code, notes, and snippets.

View MIchaelMainer's full-sized avatar

Michael Mainer MIchaelMainer

View GitHub Profile
@MIchaelMainer
MIchaelMainer / yubikeycommitsign.md
Last active March 31, 2022 22:03
How to sign commits
@MIchaelMainer
MIchaelMainer / PowerShell Profile
Last active May 6, 2022 20:17
PowerShell profile
# code $Profile
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme powerlevel10k_lean
#Get-PoshThemes
# Set the default dir for PowerShell
Set-Location C:\repos

WIP

I've started to read some interesting articles around "coding with empathy". I finally have a name to attribute to what I've been feeling. I review code. I get concerned about future privacy incidents stemming from changes in the source. I'm concerned for future maintainers of the code base. I'm concerned for the future cognitive load costs to acquire the context to understand the code years from now. I'm concerned about my own lack of conformance to standards. I'm concerned about my co-worker's lack of code comments. I'm impressed with my co-worker's standard commit message format. I appreciate asks for standards. A lot of my feelings (not all I must admit) of concern were coming from a place of empathy - I just didn't realize it.

There is empathy for:

@MIchaelMainer
MIchaelMainer / gitDiffFilter
Last active January 21, 2021 08:09
Shows how to filter diff info
https://github.com/microsoftgraph/msgraph-sdk-dotnet/pull/869
`git diff dev -I "\/\/\sTemplate Source:.*.tt" -I "using System;" --ignore-space-change`
# PHP to get non-doc changes.
`git diff dev -I "\s{4}\*.*"`
# .net get non doc changes
`git diff master -I "\s{4,}\/{3}.*"`
{
"HttpMethod": "PATCH",
"Url": "https://graph.microsoft.com/v1.0/me",
"Body": { "displayname": "Michael"}
}

##When customers ask a question that isn't about the client library##

Thank you for your question. Please post your question to StackOverflow and tag your post with the [microsoft-graph] tag. Make sure you include the following information:

  1. Tell us what you've tried. Include detailed reproduction steps.
  2. Link to the documentation and samples that you've used as reference.
  3. Provide an example HTTP request and response that shows the call being made. Make sure you scrub your example of any secrets.

##When customers ask a question about a service API issue

# Assuming the latest release always has typewriter.exe/
# Get information about the GitHub releases.
$feedQuery = 'https://api.github.com/repos/microsoftgraph/MSGraph-SDK-Code-Generator/releases'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$jsonObject = Invoke-WebRequest -Uri $feedQuery | ConvertFrom-Json
# GitHub release API provides the latest
if ($jsonObject.assets[0].name -eq 'typewriter.zip') {
SERVER_JAR_URL=https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar
# adjust memory usage depending on VM size
totalMem=$(free -m | awk '/Mem:/ { print $2 }')
if [ $totalMem -lt 1024 ]; then
memoryAlloc=512m
else
memoryAlloc=1024m
fi
@MIchaelMainer
MIchaelMainer / MSGraphLinter.ps1
Created September 24, 2018 17:01
IDEA: Create a linter and pre-commit git hook to check that we don't checkin secrets
# Linter will check for client secrets, and other best practices around using MSGraph.