Skip to content

Instantly share code, notes, and snippets.

View jdthorpe's full-sized avatar
💭
Can we all just agree it's pronounced "kubernetes"

Jason Thorpe jdthorpe

💭
Can we all just agree it's pronounced "kubernetes"
View GitHub Profile
@jdthorpe
jdthorpe / Automating Microsoft 365 Administration.md
Last active August 29, 2023 20:48
Automating Microsoft 365 administration with the m365 CLI

Microsoft M365 Account Management

This guide provides a brief introduction to administering Microsoft 365 using the m365 CLI targeted at new PowerShell users. Many Microsoft 365 administrative tasks can be easily automated with PowerShell and the Microsoft 365 command line interface (cli), such as creating and deleting user accounts, granting and revoking licenses and many others!

The m365 CLI for Microsoft 365 is a Microsoft 365 Platform Community (PnP) project. Microsoft 365 Platform Community is a virtual team consisting of

@jdthorpe
jdthorpe / Adding App Services to an Azure Key Vault Firewall.sh
Created July 4, 2023 15:51
Adding App Services to an Azure Key Vault Firewall
# --------------------------------------------------
# Configuration
# --------------------------------------------------
# names of the app service or funciton app details
app_grp=myAppResourceGroup
app_name=MyAppServiceOrFunctionApp
# key vault details
valut_grp=MyKevaultResourceGroup
@jdthorpe
jdthorpe / login.tsx
Created March 16, 2023 22:48
expo-auth-session example
/* An example app that uses expo-auth-session to connect to Azure AD (or hopefully most providers)
Features:
- secure cache with refresh on load
- securely stored refresh token using expo-secure-store
- uses zustand for global access to the token / logout
Based on [this gist](https://gist.github.com/thedewpoint/181281f8cbec10378ecd4bb65c0ae131)
*/
@jdthorpe
jdthorpe / Azure Devops Boards Notes.md
Last active April 13, 2022 21:59
Azure Devops Quirks

High Level Objects

  • The Organization is the Root of the Azure DevOps (ADO)
  • Projects are the highest level Azure Devops Container -- Everything lives within a project
  • Teams are groups of people -- managed within a project

Boards

  • Boards are for managing teams -- Select on login or at the top of the page
  • Boards implement a Process (Basic, Agile, Scrum, Custom)
@jdthorpe
jdthorpe / Fast Manhattan Distance and Pairwise Min.md
Last active March 30, 2022 16:50
Fast Manhattan distance between a vector and each row in a matrix.

Fast sparse, exact KNN Manhattan Distance

Given a 1xN (row) vector and a MxN matrix, the code below calculates the manhattan distance between the row vector and each row in the matrix. It uses Numba for significant speadup.

Currenlty I'm using this to calculate distances between a 1 x 60K row vector and a 64k x 60x matrix (with about 500k non-empty values) in ~ 10ms on a single processor

@jdthorpe
jdthorpe / FetchXML.md
Last active July 3, 2024 15:56
Notes on FetchXML

Learn to Love Tolerate FetchXML

Overview

FetchXML seems to be a quirky subset of the SQL implemented in XML and optimized for UI tasks, including:

  • the ability select specific fields (foo, b.bar) or all fields (*) from an entity
  • perform LEFT OUTER and INNER joins
  • assign aliases to attributes (select a.b as foo) and (joined) entities (left join foo as BAR)

Motivation

Least Recently Used Caching can fail when usage frequency is correlated with object size. For example an address database sharded by City and State would likely have increased activity in the largest shards. The cache may initially contains a random subset of cities (e.g. due to an automated process that runs through cities alphabetically) but can eventually become populated by just the largetst shards due to organic traffic (i.e. user based web traffic).

This code is inspired by this gist

@jdthorpe
jdthorpe / Sample 1.py
Created July 8, 2020 16:38
Python Lessons
import msvcrt
# Binary codes for escape and control+C
ESCAPE = b'\x1b'
COTNROL_C = b'\x03'
RGB = [0,0,0]
while True:
@jdthorpe
jdthorpe / JSON and YAML to Python NameSpaces.md
Last active February 7, 2023 02:34
JSON and YAML Encoders / Decoders for use with SimpleNamespaces

Load and Dump JSON and YAML to / From NamesSpaces

Why

Typed Namespaces ensure object typing is correct in the IDE!

Usage

import yaml
@jdthorpe
jdthorpe / Favorite Courses.md
Last active January 20, 2023 16:52
A few of my favorite courses

These are a few of my favorite courses on tech topics

General Coding:

Aside: when writing python packages (not just scripts), consider haveing the phrase "If its name has no dots, you cannot use relative imports" tattooed someplace readily accessible.

Aside 2: In python multiprocessing, you cannot use interactive telatype to interact with subprocesses, so if your subprocess that reaches a a call to pdb.set_trace(), the sub-process will simply hang waiting for a reponse, which can be a real pain to debug