Skip to content

Instantly share code, notes, and snippets.

View rjygraham's full-sized avatar

Ryan Graham rjygraham

View GitHub Profile
@rjygraham
rjygraham / configuration.dsc.yaml
Last active March 20, 2024 15:40
Dev Home Machine Config
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
configurationVersion: 0.2.0
assertions:
- resource: Microsoft.Windows.Developer/OsVersion
directives:
description: Verify min OS version requirement
allowPrerelease: true
settings:
MinVersion: '10.0.22000'
@rjygraham
rjygraham / Check-MovableAzureResources.ps1
Created June 1, 2023 18:58
Check Movable Azure Resources
[CmdletBinding()]
param (
[Parameter(Mandatory = $True)]
[string]
$TargetSubscriptionId,
[Parameter(Mandatory = $True)]
[string]
$TargetResourceGroup,
[string]
$SourceSubscriptionId,
@rjygraham
rjygraham / gh-clone-folder.txt
Created March 1, 2023 16:36
GitHub clone folder
git clone --depth 1 --filter=blob:none --sparse https://github.com/dotnet/samples dotnet_samples
cd dotnet_samples
git sparse-checkout set orleans
@rjygraham
rjygraham / CreateCosmosClient.cs
Last active January 23, 2023 20:56
NewtonsoftJsonCosmosSerializer
public CosmosClient CreateCosmosClient()
{
var jsonSerializerSettings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
var cosmosOptions = new CosmosClientOptions
@rjygraham
rjygraham / test.html
Created July 14, 2022 22:20
SVG animated glowing line
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
background-color: black;
}
</style>
</head>
@rjygraham
rjygraham / RandomStringGenerator.cs
Created May 23, 2022 17:30
.NET 6 cryptographic random string generator
public static class RandomStringGenerator
{
public static string Next(int length)
{
var chars = new byte[length];
for (var i = 0; i < length;)
{
// 0-9: 48-57
// A-Z: 65-90
@rjygraham
rjygraham / deploy.ps1
Last active February 24, 2022 16:26
Bicep Management Group template cycle error
New-AzTenantDeployment -TemplateFile .\managementGroups.bicep -TemplateParameterFile .\managementGroupsHierarchy.parameters.json -Location eastus
@rjygraham
rjygraham / profile.ps1
Created July 19, 2021 18:31
PowerShell base64 profile function
function base64 {
param (
[Parameter(Mandatory=$true, ValueFromPipeline)]
[string] $Value,
[Parameter(Mandatory=$false, ValueFromPipeline=$false)]
[Switch] $Decode
)
if ($Decode) {
return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value))

Keybase proof

I hereby claim:

  • I am rjygraham on github.
  • I am rjygraham (https://keybase.io/rjygraham) on keybase.
  • I have a public key whose fingerprint is D9D8 1F68 B635 7C18 4101 8C28 B586 8C77 AAE8 9E33

To claim this, I am signing this object: