Skip to content

Instantly share code, notes, and snippets.

View amis92's full-sized avatar

Amadeusz Sadowski amis92

View GitHub Profile
@amis92
amis92 / wsus.md
Created June 25, 2018 10:52
WSUS use Windows Update
@amis92
amis92 / update-nuget.ps1
Last active January 18, 2024 14:22
Script to update nugets using dotnet list package --outdated JSON output, with Allegro Pay filtering possible, and support for WhatIf+Confirm
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter()]
[switch]
$InternalOnly
)
$ErrorActionPreference = 'Stop'
function Invoke-Native {
function Invoke-Native {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0, ValueFromPipeline)]
[scriptblock[]]
$Call
)
process {
foreach ($item in $Call) {
$invocation = $ExecutionContext.InvokeCommand.ExpandString($item).Trim()
<style>
#hideCostButton:checked ~ * .costs {
display: none;
}
</style>
<label>
Hide costs
</label>
<input id="hideCostButton" type="checkbox">
<h1>
@amis92
amis92 / publications.md
Last active November 3, 2020 11:51
unifying publications in wh40k
# in repo directory
$files = dir * -Include *.cat,*.gst
$datas = $files | % { [xml] (cat $_) }
$roots = @($datas.catalogue, $datas.gameSystem) | % { $_ } | ? {$_}

# show all unique pub names
$roots.publications.publication.name | % { $_ } | select -Unique | sort
@amis92
amis92 / README.md
Last active October 15, 2020 20:02
XmlSerialization code generation

Generated XmlSerializers source code using modified wham Source Core classes from https://github.com/WarHub/wham/commit/7d6227957b1b13bd84775f83d4d9a64041d7c825

Core classes were modified to all have getters and setters.

This should make writing custom XmlSerialization source code generation easier - to have a basis.

The included code won't work primarily because of ImmutableArray. Immutable collections are not handled correctly by XmlSerializer on deserialization.

Useful links:

  • How the source code is generated:
@amis92
amis92 / main.csx
Last active October 6, 2020 17:40
BSData duplicate ID analysis script
#!/usr/bin/env dotnet-script
#r "nuget: System.Linq.Async, 4.1.1"
#r "nuget: Optional, 4.0.0"
#r "nuget: WarHub.ArmouryModel.Workspaces.BattleScribe, 0.11.0"
#r "./script/bin/netcoreapp3.1/WarHub.GodMode.SourceAnalysis.dll"
using WarHub.ArmouryModel.ProjectModel;
using WarHub.ArmouryModel.Source;
using WarHub.ArmouryModel.Source.BattleScribe;
@amis92
amis92 / Test.cs
Created March 18, 2020 10:44 — forked from HaloFour/Test.cs
Test inheritance with struct builders
/*
public record class Person {
public required int ID { get; init; }
public string FirstName { get; init; }
public string LastName { get; init; }
}
public record class Student : Person {
public required double Gpa { get; init; }
}