Skip to content

Instantly share code, notes, and snippets.

View JamesDBartlett3's full-sized avatar

James D. Bartlett III JamesDBartlett3

View GitHub Profile
@JamesDBartlett3
JamesDBartlett3 / ReplacePowerBIDatasetSourceDataflowIDs.csx
Created June 23, 2021 01:12
Run this script in Tabular Editor to replace the source Dataflow GUIDs in your Power BI Dataset
// This script is used to change the DataflowID & WorkspaceID on all partitions in the model
var oldWorkspaceId = "";
var newWorkspaceId = "";
var oldDataflowId = "";
var newDataflowId = "";
// Loop through all partitions on the model, replacing the DataflowIDs & WorkspaceIDs
foreach(var p in Model.AllPartitions.OfType<MPartition>())
{
@JamesDBartlett3
JamesDBartlett3 / CopyServerPortConnectionStringToClipboard.pbitool.json
Last active September 12, 2021 22:40
Copy 'Server:Port' Connection String to Clipboard {Power BI External Tool}
{
"version": "0.0.3",
"name": "Copy Server:Port",
"description": "Copies the currently connected Sever name and Port number from Desktop onto your clipboard. Format of the copied connection string is of 'server:port'.",
"path": "C:\\windows\\System32\\mshta.exe",
"arguments": "vbscript:Execute(\"CreateObject(\"\"Wscript.Shell\"\").Run \"\"powershell.exe -NoLogo -Command \"\"\"\"& {'%server%' | Set-Clipboard}\"\"\"\"\"\", 0 : window.close\")",
"iconData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAD7CAYAAABOrvnfAAAACXBIWXMAAAsSAAALEgHS3X78AAAKXUlEQVR4nO3dT2iUdx7H8W8yMaOJJkYIKESqCB50aVZv20vFXPS04kGPWoh71aXeHtotXeZWqJ4N1KuFbd2THoq6F10QrIXqoSDTrgG7BI07NtHJv1l+j5mlXf8+kzwz39/zeb9A8BL9ZWbe8zy/md/z/LoajYYB0NDN8wzoIHhACMEDQggeEELwgBCCB4T0ZP1VkyT5hBcI2uxapVK5xoO+cpm/h0+ShC/u0Ql/rlQqZ3jkV4ZTesTi8yRJzvNsrQxHeMTmOzPbV6lUHvPMZccRHrEZNbMfkyT5Pc9cdgSPGA2a2bdJkhzn2cuG4BGzL5jXZ8McHkXwDzM7xLz+zTjCowjeN7PbzOvfjOBRFO+EBTrM61+P4FEkg8vzehbovAJzeBTV383sOPP638o9+P3797c8OBTfrVu37PHj3Jr8bjn627yUnst88U
@JamesDBartlett3
JamesDBartlett3 / SSMS_Dark_Mode.ps1
Last active May 21, 2021 21:14
Enables Dark Mode on SSMS 2016, 17, or 18.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) { `
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs; exit }
# SSMS 2016
# powershell -Command "(Get-Content 'C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.pkgundef') -Replace '\[\`$RootKey\`$\\Themes\\{1ded0138-47ce-435e-84ef-9ec1f439b749}\]', '//[`$RootKey`$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' | Out-File 'C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.pkgundef'"
# SSMS 17
# powershell -Command "(Get-Content 'C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\ssms.pkgundef') -Replace '\[\`$RootKey\`$\\Themes\\{1ded0138-47ce-435e-84ef-9ec1f439b749}\]', '//[`$RootKey`$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]' | Out-File 'C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn
@JamesDBartlett3
JamesDBartlett3 / Focus-WindowByName.ps1
Last active February 17, 2021 09:01
A clever little PowerShell & WScript hack that brings the application named in single quotes to the front, or "focuses" it.
PowerShell -Command "$($wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('Power BI Desktop') | Out-Null);"
// Reference for updates: https://gist.github.com/NicolaiSoeborg/df8fd374e94cbadedb0902858c1354c2
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
@JamesDBartlett3
JamesDBartlett3 / tensorflow-vs-openvino-performance-benchmark.ipynb
Last active July 9, 2020 05:09
TensorFlow vs. OpenVINO: Performance Benchmark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JamesDBartlett3
JamesDBartlett3 / tarx.sh
Created May 14, 2020 01:58 — forked from alphapapa/tarx.sh
tarx: Tar and compress files showing progress using tqdm or pv
#!/bin/bash
# Tar and compress files using tqdm or pv for a progress bar.
# * Safety
# NOTE: These are disabled by default in this template but should be
# enabled when feasible. Documentation is from the Bash man page.
# ** errexit
@JamesDBartlett3
JamesDBartlett3 / conv_output.py
Last active April 18, 2020 16:03 — forked from avmoldovan/conv_output.py
Pytorch Conv2d: Helper Functions for Output Shape & Padding
#shamelessly copied from here https://discuss.pytorch.org/t/utility-function-for-calculating-the-shape-of-a-conv-output/11173/7
# original docs at https://pytorch.org/docs/master/nn.html#conv2d
import math
def num2tuple(num):
return num if isinstance(num, tuple) else (num, num)
def conv2d_output_shape(h_w, kernel_size=1, stride=1, pad=0, dilation=1):
h_w, kernel_size, stride, pad, dilation = num2tuple(h_w), \
@JamesDBartlett3
JamesDBartlett3 / arctic.sh
Created February 2, 2020 15:25
Add Repo To GitHub Arctic Code Vault
#!/bin/bash
git pull
echo "Backup this repo to GitHub Arctic Code Vault" > ice_ice_baby.md
git add .
git commit -m "arctic code vault commit"
git push origin master
@JamesDBartlett3
JamesDBartlett3 / Video_Preview.ipynb
Created December 24, 2019 13:33
Video Preview In Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.