Skip to content

Instantly share code, notes, and snippets.

View nick-beer's full-sized avatar

Nick Beer nick-beer

  • National Instruments
  • Austin
View GitHub Profile
@nick-beer
nick-beer / PushFrameUntilComplete.cs
Created May 30, 2021 10:50
Using PushFrame in a WPF application to prevent UI thread deadlock while synchronously waiting for a task.
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
namespace WpfApp3
{
/// <summary>
@nick-beer
nick-beer / RawIOReadExtensions.cs
Last active January 21, 2023 14:12
Simple/Demonstration extension method to provide async/await on top of IVI VISA IMessageBasedRawIO Read APIs
namespace Ivi.Visa;
public static class RawIOReadExtensions
{
public static async ValueTask ReadAsync(
this IMessageBasedRawIO io,
byte[] buffer,
long index = 0,
long count = -1,
CancellationToken cancellationToken = default)
@nick-beer
nick-beer / Install-PythonEnvironment.ps1
Created November 9, 2024 19:58
Install Python Environment - Windows
#Requires -RunAsAdministrator
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[string]
$PythonVersion = '3.9.13'
)
function Update-Environment {