Skip to content

Instantly share code, notes, and snippets.

View alfredmyers's full-sized avatar

Alfred Myers alfredmyers

View GitHub Profile
@alfredmyers
alfredmyers / TrollingEquality.cs
Created August 17, 2018 11:25
Trolling Equality
public static bool operator ==(Trololoh left, Trololoh right) {
return new Random().Next(2) % 2 == 0;
}
@alfredmyers
alfredmyers / Program.cs
Created November 1, 2018 12:16
Enumerates an prints argument values out to the console
using System;
class Program
{
static void Main(string[] args)
{
foreach (var arg in args)
{
Console.WriteLine(arg);
}
@alfredmyers
alfredmyers / Dedupe-Files.ps1
Last active February 8, 2019 22:19
Removes file duplicates based on content's hash
$fork = "C:\Users\Alfred\Desktop\MyBooks" # Directory possibly containing duplicate files
$repo = "C:\Books" # Directory containing master files
$repoHashes = (Get-ChildItem $repo -Recurse -File | Get-FileHash).Hash
Get-ChildItem $fork -Recurse -File |
Where-Object { $repoHashes.Contains(($_ | Get-FileHash).Hash) } |
Remove-Item
@alfredmyers
alfredmyers / keybase.md
Created March 21, 2019 00:56
keybase.md

Keybase proof

I hereby claim:

  • I am alfredmyers on github.
  • I am alfredmyers (https://keybase.io/alfredmyers) on keybase.
  • I have a public key ASDzKvslj1xb9F9O7uIdSU1LCDLJOa62pYawLQ1m85gFwQo

To claim this, I am signing this object:

@alfredmyers
alfredmyers / launch.json
Last active May 1, 2019 14:15
launch.json for debugging Node.js in VSCode started from WSL
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\entry-point.js",
"useWSL": true
}
@alfredmyers
alfredmyers / export
Last active May 31, 2019 02:01
Gist for copying Visual Studio Code extensions
code --list-extensions > vscode-extensions.txt
@alfredmyers
alfredmyers / install-vs-code-extensions.sh
Last active May 31, 2019 03:26
Install Visual Studio Code extensions from list
#!/bin/bash
curl https://alfredmyers.github.io/codex/all.txt | xargs -L 1 code --install-extension
@alfredmyers
alfredmyers / Power-V.psm1
Last active September 8, 2019 22:55
Power-V: PowerShell scripts for managing Hyper-V virtual machines
function Get-OrphanedVHDs {
$rootedVHDs = (Get-VM).HardDrives.Path + (Get-VM | Get-VMSnapshot).HardDrives.Path
Return Get-ChildItem (Get-VMHost).VirtualHardDiskPath | Where-Object { $_.FullName -notin $rootedVHDs }
}
function New-VirtualMachine {
Param(
$Name,
$MemoryBytes,
$VHDSizeBytes,
@alfredmyers
alfredmyers / README
Last active August 29, 2019 14:11
Fixes RHEL 8.0 Server with GUI over Hyper-V
When installing RHEL 8.0 on Hyper-V in Windows 10,
if you choose the option "Server with GUI" and proceed installing the OS
the VM will eventually boot into a blank screen as described at
https://access.redhat.com/solutions/4206491
The acompaining script installs the missing package.
@alfredmyers
alfredmyers / get-all-msdn-mag-issues.sh
Created November 12, 2019 11:25
Gets all MSDN Magazine issues
#!/bin/bash
wget https://docs.microsoft.com/en-us/archive/msdn-magazine/msdn-magazine-issues -qO - | grep -o -P 'http://.*(pdf|chm)' | wget -i -