Skip to content

Instantly share code, notes, and snippets.

View pjirsa's full-sized avatar

Phil Jirsa pjirsa

View GitHub Profile
@pjirsa
pjirsa / gist:92e59b8bf342a339201faa066dd777c2
Created March 13, 2024 18:04
how to update local branch with changes from main branch
git fetch
git merge origin/main
@pjirsa
pjirsa / README.MD
Created January 16, 2024 20:03
Skip GPG Signing for dev container repo

git config --local commit.gpgsign false

@pjirsa
pjirsa / main.ps1
Created October 21, 2022 14:54
fetch healthcare articles from AAC
$result = curl "https://api.github.com/search/code?q=healthcare+repo%3AMicrosoftDocs%2Farchitecture-center+language%3AMarkdown+path%3Adocs&type=Code&page=1" | convertfrom-json
$result.items | format-table name, path
@pjirsa
pjirsa / createSPN.ps1
Last active October 7, 2022 18:12
Create Service Principal for RBAC
$spnName = Read-Host -Prompt "Enter new FHIR SPN name"
$subId = Read-Host -Prompt "Enter Azure Subscription Id"
$rgName = Read-Host -Prompt "Enter resource group name of FHIR API"
$fhirName = Read-Host -Prompt "Enter name of FHIR API resource (i.e. myfhirapi)"
az login
$spn = az ad sp create-for-rbac -n $spnName | convertfrom-json
az role assignment create --role "FHIR Data Reader" --assignee $spn.appId `
--scope "/subscriptions/$subId/resourceGroups/$rgName/providers/Microsoft.HealthcareApis/services/$fhirName"
@pjirsa
pjirsa / resources.md
Last active October 13, 2022 18:21
Azure Function Resource Links
@pjirsa
pjirsa / get-graphir-token.ps1
Created September 27, 2022 19:06
get graphir token
az login
az account get-access-token `
-t c2c1d092-cf24-4636-a284-203c93601579 `
--scope api://f0e9be33-2224-430d-a7b7-6e6c1ab69a29/.default
@pjirsa
pjirsa / createandassigngroups.ps1
Last active September 7, 2022 14:02
Create Resource Groups and Assign Owner Role
$subscriptionId = "<azure subscription id>"
Connect-AzAccount -SubscriptionId $subscriptionId
$users = Import-Csv ./userlist.csv
foreach ($user in $users) {
$user
$g = Get-AzResourceGroup -Name $user.AzureGroup -ErrorVariable notFound -ErrorAction SilentlyContinue
if ($notFound) {
$g = New-AzResourceGroup -Name $user.AzureGroup -Location "Central US"
@pjirsa
pjirsa / getAADToken.ps1
Last active April 22, 2022 11:35
Use Azure CLI to acquire access token for custom API
$appId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46" #global appId for az CLI
$apiId = "5d6db6cd-cce5-47c4-8700-000efa22e068" #appId of your custom API
$requestScope = "api://localhost/5d6db6cd-cce5-47c4-8700-000efa22e068/.default" #scope exposed by your custom API app registration
## First time only
az login
az ad sp create --id $appId
az ad app permission grant --id $appId --api $apiId --scope "access_as_user"
## Get new token
@pjirsa
pjirsa / github-bfg-guide.md
Last active April 6, 2022 13:01
Remove secrets from Git history

Oh NO! I accidentally committed a secret value to GitHub

Here is the procedure that works the best while being the least destructive

  1. Open the repo using a new Codespace
  2. Using the terminal, download BFG tool.
cd ..
curl https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar bfg.jar
  1. IMPORTANT Clone a mirror of the repo (the git database only) so we don't mess with any local files
@pjirsa
pjirsa / AzureCLI.md
Last active March 24, 2022 14:48
Azure CLI

snippets

Useful code snippets for future reference

Azure Container Instances

Run nextflow-io/hello sample pipeline in ACI

az container create \
  --resource-group demo-aci \
  --name demo-aci \
 --image nextflow/nextflow:21.10.6 \