Skip to content

Instantly share code, notes, and snippets.

View aienabled's full-sized avatar

Vladimir Kozlov aienabled

View GitHub Profile
@a4099181
a4099181 / Convert-ToPackageReference.ps1
Last active February 18, 2021 07:00
Converts packages.config into PackageReference at *.csproj project file. Requires XSLT stylesheet available as second file in the gist.
Function Convert-ToPackageReference
{
Param ( [Parameter( Mandatory, ValueFromPipeline )][String] $inputUri,
[String] $stylesheetUri = "https://gist.githubusercontent.com/a4099181/074a6c3dd524ea0d343382137492399c/raw/cdd0fb31efd70c4c0f8c86ddb314de86ab8972e8/Convert-ToPackageReference.xsl",
[String] $resultsFile = [System.IO.Path]::GetTempFileName() )
Process {
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform
$xslt.Load( $stylesheetUri )
$xslt.Transform( $inputUri, $resultsFile )
@Jargon64
Jargon64 / RSACryptoServiceProviderExtensions.cs
Last active November 29, 2021 02:11
RSACryptoServiceProvider Extension to add FromXmlString and ToXmlString methods for ASP.NET Core
using System;
using System.Security.Cryptography;
using System.Xml;
namespace RSACryptoServiceProviderExtensions
{
public static class RSACryptoServiceProviderExtensions
{
public static void FromXmlString(this RSACryptoServiceProvider rsa, string xmlString)
{
@hperantunes
hperantunes / tail-grep.ps1
Created February 25, 2016 16:45
tail + grep powershell equivalent
Get-Content C:\temp\mylogfile.log -tail 100 –wait | Select-String 'search'
@sliekens
sliekens / TypeMemberLayout.xaml
Last active December 28, 2023 08:45
StyleCop Type Member Layout for Resharper 9
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
@jen20
jen20 / CharacterEllipsisButtonStyle.xaml
Created January 6, 2014 18:06
WPF style which puts character ellipsis on button contents without replacing the ContentPresenter with a TextBlock and thus losing the ability to support access keys.
<Style x:Key="CharacterEllipsisTextButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>