This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://stackoverflow.com/a/74976541/4087397 | |
function Hide-ConsoleWindow() { | |
# Import 'ShowWindowAsync' method to properly hide windows | |
Add-Type -Name User32 -Namespace Win32 -MemberDefinition ` | |
'[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' | |
# Mangle the window title to ensure it's unique and allow us to find it | |
$Host.UI.RawUI.WindowTitle = [Guid]::NewGuid() | |
# Find our process by the mangled window title and hide it | |
[Win32.User32]::ShowWindowAsync( | |
(Get-Process).where{ $_.MainWindowTitle -eq $Host.UI.RawUI.WindowTitle }.MainWindowHandle, 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
#Requires -Version 7 | |
function Install-PythonRelease { | |
<# .SYNOPSIS | |
Install the Python language interpreter #> | |
param( | |
# Install for all users (requires admin) | |
[Switch]$AllUsers, | |
# Use beta build instead of latest stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
# Inspired by: https://weblogs.asp.net/jongalloway/downloading-a-local-nuget-repository-with-powershell | |
function Update-LocalNugetRepository { | |
<# .SYNOPSIS | |
Update a local Nuget repo from a remote repo #> | |
Param( | |
# Remote repository feed URL | |
[Uri]$FeedURLBase = 'https://aka.ms/sme-extension-feed', | |
# Local repository directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Get-GHRepoList { | |
<# .SYNOPSIS | |
Gets a list of repositories of a GitHub user. #> | |
Param( | |
# User to enumerate | |
[string]$User, | |
# Page size to request | |
[int]$Size = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#/etc/profile.d/xdg_dirs.sh | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
############################################################################### | |
# XDG variables | |
############################################################################### | |
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}" | |
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" | |
export XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Vesion Latest | |
function Invoke-GithubFileRequest { | |
<# .SYNOPSIS | |
Retrieves a file from a Github repository. #> | |
[Alias('gh_curl')] | |
Param( | |
# URL of file to download | |
[Parameter(Mandatory)] | |
[Uri]$URL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from PIL import Image | |
def draw_grid(size_x=1920, size_y=1080, grid_x=3, grid_y=3, border=2, img_x=0, img_y=0): | |
if img_x == 0 or img_y == 0: | |
img_x, img_y = size_x, size_y | |
img = Image.new('RGB', (img_x, img_y), 'white') | |
pixels = img.load() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Get-ArpEntry { | |
<# .SYNOPSIS | |
Retrieve system ARP table entries #> | |
Param( | |
# Retrieve all entries (not just learned) | |
[switch]$All | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only run if elevated as administrator | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$admin = [Security.Principal.WindowsBuiltInRole]::Administrator | |
if (!([Security.Principal.WindowsPrincipal]$identity).IsInRole($admin)) { | |
Write-Output 'We are not elevated, launching elevated powershell...' | |
Start-Process -FilePath powershell.exe -Verb RunAs -ArgumentList $MyInvocation.MyCommand.Source | |
Start-Sleep 10 | |
exit 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Edit-VMDKHeader { | |
<# .SYNOPSIS | |
Edit the metadata header of a VMDK file #> | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] | |
Param( | |
# The VMDK file to edit | |
[Parameter(Mandatory)] | |
[string]$VMDKFile |