Skip to content

Instantly share code, notes, and snippets.

Avatar

Alfred Myers alfredmyers

View GitHub Profile
@alfredmyers
alfredmyers / Program.cs
Created Nov 20, 2019
Sample code demonstrating the difference between value types and reference types regarding the mutability of their readonly fields
View Program.cs
using System;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
var valueType = new ValueType(1);
Console.WriteLine(valueType.ReadOnlyField);
@alfredmyers
alfredmyers / get-all-msdn-mag-issues.sh
Created Nov 12, 2019
Gets all MSDN Magazine issues
View get-all-msdn-mag-issues.sh
#!/bin/bash
wget https://docs.microsoft.com/en-us/archive/msdn-magazine/msdn-magazine-issues -qO - | grep -o -P 'http://.*(pdf|chm)' | wget -i -
@alfredmyers
alfredmyers / README
Last active Aug 29, 2019
Fixes RHEL 8.0 Server with GUI over Hyper-V
View README
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 / Power-V.psm1
Last active Sep 8, 2019
Power-V: PowerShell scripts for managing Hyper-V virtual machines
View Power-V.psm1
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 / install-vs-code-extensions.sh
Last active May 31, 2019
Install Visual Studio Code extensions from list
View install-vs-code-extensions.sh
#!/bin/bash
curl https://alfredmyers.github.io/codex/all.txt | xargs -L 1 code --install-extension
@alfredmyers
alfredmyers / export
Last active May 31, 2019
Gist for copying Visual Studio Code extensions
View export
code --list-extensions > vscode-extensions.txt
@alfredmyers
alfredmyers / launch.json
Last active May 1, 2019
launch.json for debugging Node.js in VSCode started from WSL
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\entry-point.js",
"useWSL": true
}
View 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 / Dedupe-Files.ps1
Last active Feb 8, 2019
Removes file duplicates based on content's hash
View Dedupe-Files.ps1
$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 / Program.cs
Created Nov 1, 2018
Enumerates an prints argument values out to the console
View Program.cs
using System;
class Program
{
static void Main(string[] args)
{
foreach (var arg in args)
{
Console.WriteLine(arg);
}