Skip to content

Instantly share code, notes, and snippets.

<Configuration>
<ViewDefinitions>
<View>
<Name>Utility.PullRequest</Name>
<ViewSelectedBy>
<TypeName>Utility.PullRequest</TypeName>
</ViewSelectedBy>
<CustomControl>
<CustomEntries>
<CustomEntry>
{
"version": "0.1.0",
"description": "Decode and deflate base64 strings of gzip data",
"homepage": "https://github.com/SeeminglyScience/psudad",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/SeeminglyScience/psudad/releases/download/v0.1.0/psudad-0.1.0-win-x64.zip",
"hash": "fd1b7200021221f071033ec3c40007fcc21372086f4aa1d3999d212f581db3c4"
}
using namespace System
using namespace System.Linq
using namespace System.Collections
using namespace System.Collections.Generic
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
using namespace System.Reflection
# Hey person reading this! Don't do this, alright? You'll have a bad time. ty
function ConvertTo-BitString {
[Alias('bits')]
[CmdletBinding(PositionalBinding = $false)]
param(
[Parameter(ValueFromPipeline)]
[psobject[]] $InputObject,
[Parameter(Position = 0)]
[ValidateRange(1, [int]::MaxValue)]
using namespace System.Management.Automation
# Use of StopUpstreamCommandsException is obviously not supported. Subject to breaking at any time.
function Select-FirstObject {
[Alias('first', 'top')]
[CmdletBinding(PositionalBinding = $false)]
param(
[Parameter(ValueFromPipeline)]
[psobject] $InputObject,
@SeeminglyScience
SeeminglyScience / GetCsprojInfo.ps1
Created January 27, 2020 17:15
Example for getting evaluated properties from a csproj. Wrote for a build script I ended up not needing currently.
$FailOnError = @{ ErrorAction = 'Stop' }
$ModuleName = 'MyModule'
$SourcePath = "$PSScriptRoot\src\$ModuleName"
$TargetSdkVersion = '3.1.100'
$FrameworksToProcess = [string[]]::new(0)
$BoundParameters = @{}
$FrameworkPaths = @{}
$AssemblyVersion = ''
$PackageVersion = ''
$CppHeaderFilePath = 'path/to/something.h'
$interfaceDefinition = Get-Content $CppHeaderFilePath -Raw
$flags = [Reflection.BindingFlags]::NonPublic -bor [Reflection.BindingFlags]::Instance
$fields = @{
_a = [guid].GetField('_a', $flags)
_b = [guid].GetField('_b', $flags)
_c = [guid].GetField('_c', $flags)
_d = [guid].GetField('_d', $flags)
_e = [guid].GetField('_e', $flags)
_f = [guid].GetField('_f', $flags)
@SeeminglyScience
SeeminglyScience / emca-335-i.11.md
Last active June 25, 2023 16:38
Rules for CLS-compliance

[I.11 Collected Common Language Specification rules][§I.11]

The complete set of CLS rules are collected here for reference. Recall that these rules apply only to "externally visible" items—types that are visible outside of their own assembly and members of those types that have public, family, or family-or-assembly accessibility. Furthermore, items can be explicitly marked as CLS-compliant or not using the System.CLSCompliantAttribute. The CLS rules apply only to items that are marked as CLS-compliant.

  1. CLS rules apply only to those parts of a type that are accessible or visible outside of the defining assembly. ([§I.7.3])

  2. Members of non-CLS compliant types shall not be marked CLS-compliant. ([§I.7.3.1])

  3. Boxed value types are not CLS-compliant. ([§I.8.2.4].)

@SeeminglyScience
SeeminglyScience / console-settings.reg
Last active August 17, 2020 17:53
My registry values for conhost configuration. Note that "FaceName" is "__DefaultTTFont__" because I set the font within my PowerShell profile. Make sure to remove application specific subkeys under "Console" as they will override these settings.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:00000000
"ColorTable01"=dword:00800000
"ColorTable02"=dword:00005000
"ColorTable03"=dword:00808000
"ColorTable04"=dword:0000003c
"ColorTable05"=dword:00562401
"ColorTable06"=dword:00f0edee
function Expand-MemberInfo {
[Alias('emi')]
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline, Mandatory)]
[Alias('Member')]
[psobject] $InputObject,
[Parameter()]
[ValidateSet('IL', 'CSharp', 'VisualBasic')]