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 / Set-WindowState.ps1
Last active November 30, 2022 20:35 — forked from lalibi/Set-WindowState.ps1
Hide, Show, Minimize, Maximize, etc. any application window from PowerShell.
# WARNING: NON-WORKING CODE - DO NOT USE IN PRODUCTION!
#TODO: Implement $AppName & $MainWindowHandle parameters
function Set-WindowState {
<#
.SYNOPSIS
Set a given window state using WinAPI.
.DESCRIPTION
Use the ShowWindowAsync function to set the Window state for
@JamesDBartlett3
JamesDBartlett3 / DevMachineSetup.ps1
Last active October 7, 2022 01:59 — forked from codebytes/DevMachineSetup.ps1
DevMachineSetup
# To download and install, run this command in PowerShell:
# PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/JamesDBartlett3/40d4459e39402cbc30a73731e310a27c/raw/'))"
#Install WinGet
#Based on this gist: https://gist.github.com/Codebytes/29bf18015f6e93fca9421df73c6e512c
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
// 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 / 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), \