Skip to content

Instantly share code, notes, and snippets.

View itsalljustdata's full-sized avatar

Jon Mills itsalljustdata

View GitHub Profile
@itsalljustdata
itsalljustdata / createMmdFromTmdl.py
Created November 16, 2025 04:23
Create a Mermoid ER diagram from a Semantic Model TMDL file
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathlib import Path
import re
def nameFixUp(name: str) -> str:
"""Fix up a name by replacing non-alphanumeric characters with _ and collapsing multiple _ to single _."""
if name == name.upper() or name == name.lower():
sep = '_'
else:
@itsalljustdata
itsalljustdata / createMmdFromBim.py
Created November 16, 2025 03:27
Create mermaid diagram from PowerBI model.bim file
#!/usr/bin/env python3
from argparse import ArgumentParser, Namespace
from typing import Any
from pathlib import Path
import json
import re
from collections import Counter
@itsalljustdata
itsalljustdata / getPackage.py
Created July 20, 2025 22:38
Downloads whl files from azure devops artifact feed
#!/usr/bin/env python
#
"""
requirements.txt :
requests
pydantic_settings
glom
@itsalljustdata
itsalljustdata / iommu.sh
Created October 26, 2024 05:37
lists IOMMU groups
#!/usr/bin/env bash
shopt -s nullglob
lastgroup=""
for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do
for d in $g/devices/*; do
if [ "${g##*/}" != "$lastgroup" ]; then
echo -en "Group ${g##*/}:\t"
else
echo -en "\t\t"
fi
@itsalljustdata
itsalljustdata / zsh.sh
Last active April 15, 2024 03:38
Install and configure zsh oh-my-zsh
#!/bin/bash
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
if [ "${AZURE_CLI}" == "0" ]; then
# Remove Azure CLI plugin
set -i 's/ azure / /g' ~/.zshrc
@itsalljustdata
itsalljustdata / .zshrc
Last active April 15, 2024 03:39
Default .zshrc with plugins and p10k
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@itsalljustdata
itsalljustdata / .p10k.zsh
Last active April 11, 2024 04:05
Powerlevel10k config file
# Generated by Powerlevel10k configuration wizard on 2024-04-11 at 12:05 AWST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 49778.
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode,
# round separators, round heads, flat tails, 1 line, compact, many icons, concise,
# transient_prompt, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
#
@itsalljustdata
itsalljustdata / xfsrepair
Created March 31, 2024 10:47
run xfs_repair on 5 drives
for i in $(seq 1 5); do
disk="md${i}p1"
log="${0}.${disk}.txt"
echo "${i}. ${disk} : ${log}"
xfs_repair /dev/mapper/${disk} > ${log} 2>&1
done
@itsalljustdata
itsalljustdata / roman.py
Created March 22, 2024 02:52
Converts an integer value to Roman numerals
def getRoman(theInteger : int, lcase : bool = False):
mappy = [[1,"I"]
,[4,"IV"],[5,"V"]
,[9,"IX"],[10,"X"]
,[40,"XL"],[50,"L"]
,[90,"XC"],[100,"C"]
,[400,"CD"],[500,"D"]
,[900,"CM"],[1000,"M"]
]
@itsalljustdata
itsalljustdata / SSRS.Datasets.sql
Last active February 16, 2024 00:37
SSRS Get Datasets from report definition
WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
,'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS ReportDefinition
)
SELECT CATDATA.Name AS ReportName
,CATDATA.Path AS ReportPathLocation
,xmlcolumn.value('(@Name)[1]', 'VARCHAR(250)') AS DataSetName
,xmlcolumn.value('(Query/DataSourceName)[1]', 'VARCHAR(250)') AS DataSoureName
,xmlcolumn.value('(Query/CommandText)[1]', 'VARCHAR(2500)') AS CommandText
FROM (SELECT ItemID -- Unique Identifier
,[Path] --Path including object name