Skip to content

Instantly share code, notes, and snippets.

View ygoe's full-sized avatar

Yves Goergen ygoe

View GitHub Profile
@ygoe
ygoe / KeyboardSpeed.cmd
Last active October 15, 2023 20:46
Read and set keyboard delay and speed in Windows (requires new PowerShell because I was too lazy to write old C# code 😁)
<# :
@echo off & setlocal & set __args=%* & pwsh.exe -NoProfile -Command Invoke-Expression ('. { ' + (Get-Content -LiteralPath ""%~f0"" -Raw) + ' }' + $env:__args) & exit /b %ERRORLEVEL%
#> Add-Type @'
// ========== BEGIN C# CODE ==========
using System;
using System.Runtime.InteropServices;
public class Program
{
public static void Main(string[] args)
@ygoe
ygoe / ps-csharp.cmd
Created January 29, 2022 23:20
Write your Windows batch files in C# (using PowerShell)
<# :
@echo off & setlocal & set __args=%* & %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Command Invoke-Expression ('. { ' + (Get-Content -LiteralPath ""%~f0"" -Raw) + ' }' + $env:__args) & exit /b %ERRORLEVEL%
#> Add-Type @'
// ========== BEGIN C# CODE ==========
using System;
public class App
{
public static void Run(string[] args)
{
@ygoe
ygoe / ProcessHelper.cs
Created December 17, 2020 13:46
ProcessHelper class: Provides methods for process execution and handling in C#. Because it's hard.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DotforwardControl.Shared.Extensions;
namespace DotforwardControl.Shared.Util
{
@ygoe
ygoe / ManagedUnixCrypt.cs
Created August 30, 2020 17:48
A managed implementation of the Unix C library crypt function. Supports MD5, SHA-256 and SHA-512.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace YourApp.Util
{
/// <summary>
/// A managed implementation of the Unix C library crypt function. It supports the MD5, SHA-256
/// and SHA-512 algorithms.
@ygoe
ygoe / WindowsRegistry.cs
Created July 20, 2017 08:56
A class that provides Windows registry access for .NET Framework (define NETFULL) and .NET Standard 1.6 (define NETSTANDARD) projects through P/Invoke.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32;
namespace MyNamespace
{
internal class WindowsRegistry