Skip to content

Instantly share code, notes, and snippets.

View MatsAnd's full-sized avatar

Mats Andreassen MatsAnd

View GitHub Profile
@MatsAnd
MatsAnd / get-jwks-keys.py
Created October 18, 2022 06:38
Pulls jwks keys from OAuth2 endpoints and stores on disk. Use python v2.7
import os, urllib2, json, re, textwrap
keys_path = "keys/"
keys_file_prefix = "jwks-"
keys_file_ext = ".crt"
remove_old_keys = True
idp_jwks = {
"AAD_V1": "https://login.windows.net/common/discovery/keys",
"AAD_V2": "https://login.microsoftonline.com/common/discovery/v2.0/keys",
const { step, assemble } = require('@pstnorge/slede8')
const getProgram = (requiredChars) => {
return `.DATA 0x51,0x00,0x61,0x01,0xa1,0x00,0xb1,0x01,0xc1,0x00,0x83,0x03,0x91,0x${requiredChars.toString(16)},0x06,0x02,0x04,0x03,0x72,0x05,0x55,0x67,0x25,0x72,0x25,0x32,0x15,0x2c,0x52,0x06,0x62,0x07,0x65,0xb9,0x55,0xb0,0x17,0xa9,0xe9,0x00,0x07,0xac,0x29,0x03,0xb3,0x05,0x1a,0x06,0x00,0x00,0x23,0x05,0x1a,0x06,0x00,0x00,0x51,0x51,0x57,0x7e,0x6e,0x64,0x77,0x12,0x59,0x38,0xf3,0x8a,0x48,0x3d,0xeb,0x53,0x7d,0x21,0x5c,0xaf,0x1c,0xae,0x50,0x25,0x55,0x3f,0x4b,0x6f,0x72,0x72,0x65,0x6b,0x74,0x21,0x00,0x46,0x65,0x69,0x6c,0x21,0x00,0x04,0x02,0x07,0xa2,0xd9,0x06,0x16,0x02,0x55,0xb0,0x18,0x06,0x0b,0x00`
}
const getRange = (start, end) => {
const range = []
for (let year = start; year < end + 1; year++) {
range.push(year)
@MatsAnd
MatsAnd / extract-grep-data.js
Last active October 27, 2020 10:21
Henter fagkoder, programomraader og utdanningsprogram fra UDIRs sparql-endepunkt og lagrer dataene i hver sin json-fil
(async () => {
const { post } = require('axios').default
const { stringify } = require('qs')
const { writeFile } = require('fs').promises
const config = require('./grep-config')
const repackUdirSparql = require('./repack-udir-sparql')
const logger = console.log
const extractGrepData = async (type, url, query) => {
const requestHeaders = { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' }
@MatsAnd
MatsAnd / 1 - Set-SPOUserProperties.ps1
Last active May 4, 2020 12:51
PowerShell script to update Sharepoint user profile with properties from local Active Directory
Import-Module Logger # https://github.com/vtfk/Logger
Add-LogTarget -Name Console
Add-LogTarget -Name CMTrace -Configuration @{ Path = "SetSPOUserProperties" }
Write-Log -Message "Start script.. Connecting to Sharepoint PnP"
# Connect Sharepoint PnP
Connect-Office365 -SharePointPnP -SharePointTenantName "vtfk" -Target "<azure-user>" -ErrorAction Stop
Write-Log -Message "Connected! Get employees from AD..."
@MatsAnd
MatsAnd / mac.apps.md
Last active June 9, 2022 10:56
Mac Apps and Utilities I use
@MatsAnd
MatsAnd / AzureNamingConvention.md
Last active October 2, 2023 15:58
VTFK Azure Components - Naming Convention

Navnestandard Azure-komponenter:

Subscription-Komponenttype-Beskrivelse

  • Subscription = prod, test eller dl (datasjø)
  • Komponenttype = "resource name prefix" hentet fra denne siden
  • Beskrivelse = En anekdote om tjenesten

Overordnet

  1. Som hovedregel skal alle løsninger settes opp i både dev/test- og prod-subscriptionene.
  2. Én resource group (rg) pr. tjeneste som samler alle komponenter til tjenesten. F.eks: