Skip to content

Instantly share code, notes, and snippets.

View scottmwyant's full-sized avatar

Scott M. Wyant scottmwyant

View GitHub Profile
powershell -NoExit -Command{
# Get started
Clear-Host
Write-Host
Write-Host 'Welcome to the Find-File utility!'
Write-Host
# Get the path from the user
$myPath = Read-Host -Prompt ' Path'
@scottmwyant
scottmwyant / Get-FolderSize.ps1
Created November 3, 2019 01:46
Get the size of folders found within the given directory
# The original version of this script is attributed to GingerNinja, https://www.gngrninja.com/.
# See the blog article here: https://www.gngrninja.com/script-ninja/2016/5/24/powershell-calculating-folder-sizes
<#
.SYNOPSIS
Get-FolderSize.ps1
Returns the size of folders in MB and GB.
.DESCRIPTION
@scottmwyant
scottmwyant / Combine-TextFiles.ps1
Last active February 6, 2020 21:17
Combine multiple text files into one
function Write-Title{
param([string]$Title)
Clear-Host
Write-Host
Write-Host " -- $Title --"
Write-Host
}
function Get-Path{
param([string]$Prompt, [string]$DefaultValue)
@scottmwyant
scottmwyant / SymLinks.md
Created January 6, 2020 02:39
Use symlinks to snyc settings for Git and VS Code across devices
@scottmwyant
scottmwyant / mocha.html
Created January 18, 2020 02:11
Mocha Testing in the Browser with ES6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://unpkg.com/mocha@7.0.0/mocha.css" rel="stylesheet" />
<script src="https://unpkg.com/chai@4.2.0/chai.js"></script>
@scottmwyant
scottmwyant / README.md
Created October 29, 2020 02:27
Using the VS Code Marketplace API

This request will return a whole bunch of information about a given extension, ms-python.python for example.

Note that I'm running Windows and ran into some trouble with escaping quotes. The JSON may need to be massaged a bit to work on Linux, start by replacing the double-quotes on the ends with single quotes and stripping out the escape characters (change \" to just ").

curl --request POST https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery/ --header "Accept: application/json;api-version=3.0-preview.1" --header "Content-Type: application/json" --data-raw "{\"filters\": [{\"criteria\": [{\"filterType\": 7,\"value\": \"ms-python.python\"}]}],\"flags\": 914}"

Resources:

@scottmwyant
scottmwyant / vscode-token-styles.html
Created November 13, 2020 02:13
VS Code Token Styles
<!DOCTYPE html>
<html lang="en">
<!--
This document is used visually inspect how tokens are stylized across different themes in VS Code.
Pay attention to the constant named 'myThemeData'. It is an array of objects, each object has 3 keys:
'name', 'editorBackground', and tokenColors. The editorBackground and tokenColor data is copied
from the JSON data seen by using the 'Developer: Generate Color Theme From Current Settings'
command in VS Code. The name is simply the theme's display name as seen in the VS Code menu.
@scottmwyant
scottmwyant / Remove-DuplicateFiles.ps1
Last active August 24, 2021 15:31
Remove-DuplicateFiles
#
# =============================================================================
# This script can be used to clean a folder that has 2 copies of each file.
# There should be an original version, ie "fileA.txt" and a copy,
# ie "fileA - Copy.txt". You need to review / change the values of the
# constants below.
#
# https://gist.github.com/scottmwyant/981bdffbae8898a22a558e0c75b6cbcf
# =============================================================================
#
@scottmwyant
scottmwyant / binary-hex.md
Created July 8, 2022 11:41
Binary to Hexidecimal

Converting binary to hexadecimal (base 16)

Start with a given binary string: 1111011111100

1. Break the string up into groups of 4 bits.

Start from the right. Should the last grouping not have four bits, fill in with 0.

1 1110 1111 1100 = 0001 1110 1111 1100

@scottmwyant
scottmwyant / Networking.md
Last active October 31, 2022 10:59
Helpful commands for networking on Windows

Networking with PowerShell

Taking the key points from this article: http://woshub.com/port-forwarding-in-windows/

Prerequisites

These are the prerequisites for the correct operation of port forwarding in Windows. Without the IP Helper service and without IPv6 support enabled, the port redirection won’t work.

iphlpsvc