Skip to content

Instantly share code, notes, and snippets.

@asears
asears / Update-PsGet.ps1
Created August 7, 2021 10:43
Upgrade 'PowerShellGet'
# Fix for error.
# WARNING: The version '1.4.7' of module 'PackageManagement' is currently in use. Retry the operation after closing the applications.
# Substitute version for latest here.
# https://www.powershellgallery.com/packages/PowerShellGet/2.2.5
Update-Module -Name PowerShellGet -RequiredVersion 2.2.5
@asears
asears / compact-vhdx.md
Created July 29, 2021 21:50
Compact ext4.vhdx

Compact vhdx

For that large wsl disk.

wsl.exe --list --verbose
wsl –shutdown
optimize-vhd -Path .\ext4.vhdx -Mode full
@asears
asears / sops.md
Created April 11, 2021 12:18
SOPS and Azure Key Vault

Encrypting using Azure Key Vault

The Azure Key Vault integration tries several authentication methods, in this order:

Client credentials
Client Certificate
Username Password
MSI
Azure CLI auth
@asears
asears / pythonvenv.md
Last active April 11, 2021 11:49
Python venvs

Python Virtual Environments

Options for Windows:

  1. Use Conda.
  2. Use WSL

Otherwise.

From an admin command prompt.

@asears
asears / hello-world.js
Last active February 6, 2021 22:33
Use npx "https://gist.github.com/asears/thisurl" to run a nodejs helper function.
#!/usr/bin/env node
console.log("hello world")
@asears
asears / Choco-List.txt
Last active February 2, 2021 11:50
Chocolatey installs for a PC
choco list --localonly
Chocolatey v0.10.15
7zip 19.0
7zip.install 19.0
adobereader 2019.021.20061
aimp 4.60.2161.20191202
anaconda3 2019.10
asio4all 2.14
atom 1.53.0
atom.install 1.53.0
@asears
asears / wget.sh
Created December 30, 2020 14:18 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@asears
asears / piphelp.sh
Created December 23, 2020 15:39
Pip Helper commands
#!/bin/bash
pip install -r requirements.txt
# if repo has a setup.py
pip install git+https://github.com/terrykong/tfrecord-browser
pip install .\terrykong\tfrecord-browser
pip freeze
pip freeze -r requirements.txt
pip freeze -l
pip freeze --trusted-host name:port
@asears
asears / gist:95d5590962b11edd0f3fa2d7b1d98f7b
Created November 10, 2020 12:00
Microsoft Powershell Core Profile
<#
.SYNOPSIS
Powershell Profile
.DESCRIPTION
Powershell Profile
.PARAMETER
None
.INPUTS
None
.OUTPUTS
@asears
asears / Get-ConvolutedComputerName.ps1
Created November 10, 2020 01:21
Because that's why...
# https://superuser.com/questions/1072516/open-the-start-menu-using-powershell
(New-Object -ComObject "wscript.shell").SendKeys("^{ESC}")
Start-Sleep 2
(New-Object -ComObject "wscript.shell").SendKeys("This Pc")
Start-Sleep 2
(New-Object -ComObject "wscript.shell").SendKeys("+{F10}")
(New-Object -ComObject "wscript.shell").SendKeys("s")
Start-Sleep 2
(New-Object -ComObject "wscript.shell").SendKeys("p")