Skip to content

Instantly share code, notes, and snippets.

View StephenRedd's full-sized avatar

Stephen M. Redd StephenRedd

View GitHub Profile
@StephenRedd
StephenRedd / dotnet-bump.ps1
Last active June 13, 2023 11:43
Powershell script for incrementing .Net Core *.csproj assembly versions
<#
.SYNOPSIS
Increment .NET *.csproj file version.
.DESCRIPTION
Script will increment either the minor or patch version for all projects under /src.
.PARAMETER mode
Specify 'minor' or 'patch'
@StephenRedd
StephenRedd / profile.ps1
Last active April 3, 2023 17:23
powershell profile - Two-line informational prompt, posh-git, and more
$doc = [Environment]::GetFolderPath("MyDocuments")
New-Alias vs2019 $doc\PowerShell\vs2019.ps1
# Set-Alias code "$env:LOCALAPPDATA\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" #"$env:Programfiles\Microsoft VS Code Insiders\bin\code-insiders.cmd"
function code {
#$code_path="$env:LOCALAPPDATA\Programs\Microsoft VS Code Insiders\Code - Insiders.exe"
$code_path="C:\Program Files\Microsoft VS Code Insiders\Code - Insiders.exe"
if ($args.Count -eq 0) {
Start-Process -FilePath $code_path
@StephenRedd
StephenRedd / MEFandMVC-Limitations-1-error.txt
Created May 23, 2011 11:29
blog: MEF and MVC - Limitations and workarounds for partial trust environments
Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure)'
to access type 'System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection' failed.
   
@StephenRedd
StephenRedd / FailLoop.cs
Created May 23, 2011 11:01
blog: Fail Loop
using (FileStream rdr = new FileStream(contentInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{ {
index = 1;
while (true)
{
long offset = (index - 1) * chunkSize;
long remaining = contentInfo.Length - offset;
if (remaining < 1) break; // Stop processing, at the end of the file
// stuff that doesn't ever touch the index variable