Skip to content

Instantly share code, notes, and snippets.

@DCCoder90
DCCoder90 / Start-ForAllRepos.ps1
Created May 15, 2021 00:45
Powershell scrip to iterate through a directory containing git repos and perform a specified action. https://stackoverflow.com/questions/66249041/iterate-thru-all-folders-at-the-current-path-where-the-script-resides
function global:Start-ForAllRepos
{
[CmdletBinding()]
param (
[Parameter(Position=0)]
[string]
$Cmd = 'git status',
[Parameter(Position=1)]
[string[]]
@DCCoder90
DCCoder90 / combineCSV.ps1
Created July 22, 2021 00:25
Combine all CSVs in directory to single CSV
$CSVFolder = 'C:\path\to\directory\with\csvs';
$OutputFile = 'C:\path\to\combined.csv';
$CSV = Get-ChildItem -Path $CSVFolder -Filter *.csv | ForEach-Object {
Import-Csv -Path $_
}
$CSV | Export-Csv -Path $OutputFile -NoTypeInformation -Force;
@DCCoder90
DCCoder90 / AsyncEnumerableExtensions.cs
Last active September 2, 2023 18:41
Convert IEnumerable to IAsyncEnumerable It has come to my attention that this is at the top of google search results. Before attempting to use this please read the comments below. This is old, and outdated. The comments contain better solutions. TL&DR: use System.Linq.Async's ToAsyncEnumerable()
public static class AsyncEnumerableExtensions
{
public static IAsyncEnumerable<TResult> SelectAsync<T, TResult>(this IEnumerable<T> enumerable,
Func<T, Task<TResult>> selector)
{
return AsyncEnumerable.CreateEnumerable(() =>
{
var enumerator = enumerable.GetEnumerator();
var current = default(TResult);