Skip to content

Instantly share code, notes, and snippets.

View pmunin's full-sized avatar

Philipp Munin pmunin

View GitHub Profile
@pmunin
pmunin / config-MacOS.bat
Created December 8, 2018 16:17
Installing macOs on VirtualBox for Windows
cd C:\Program Files\Oracle\VirtualBox
VBoxManage modifyvm "MacOS" --cpuid-set 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "MacOS" VBoxInternal2/EfiGopMode 4
pause
@pmunin
pmunin / WeakMapExtensions.cs
Created August 5, 2019 16:52
WeakMapExtensions
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace WeakMap
{
/// <summary>
/// Allows to link additional properties to any objects by weakly linking a dictionary for any object.
/// Weakly means the dictionary exists in memory only as long as object it linked to is still stored in memory
@pmunin
pmunin / convert-2jpg.bat
Last active December 20, 2022 15:17
Script allowing to Sort double sided scanned files. Requires Node.js 10+ to be installed and convert files (pdj->jpg)
node %~dp0convert-2jpg.js %*
pause
@pmunin
pmunin / Debouncer.cs
Last active December 20, 2022 02:03
Action Debouncer for C#
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Timers;
namespace DebounceUtils
{
/// <summary>
/// Event debouncer helps to prevent calling the same event handler too often (like mark Dirty or Invalidate)
@pmunin
pmunin / index.js
Last active March 29, 2022 02:45 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@pmunin
pmunin / EnumerablePartitionExtension.cs
Last active September 19, 2020 02:29
C# Enumerable extension for Partitioning also know as Pagination- allows to split enumerable into partitions of specified max size
using System.Linq;
public static class EnumerablePartitionExtensions{
/// <summary>
/// Generate lazy partitions for enumerable
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="items">source items to create partitions from</param>
@pmunin
pmunin / FormattableStringExtensions.cs
Created March 4, 2019 21:31
C# FormattableStringExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public static class FormattableStringExtensions
{
public static FormattableString AsFormattable(this string str) {
return FormattableStringFactory.Create(str);
@pmunin
pmunin / DictionaryDynamicWrapper.cs
Created September 3, 2019 18:39
Dynamic wrapper for Dictonary
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
public class DynamicDictionaryWrapper<TValue> : DynamicObject
{
/// <summary>
/// Instance of object passed in
@pmunin
pmunin / ConcurrentLockDictionary.cs
Last active August 6, 2019 20:20
ReadWriteLockableValue.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
namespace ConcurrentLocking
{
public class ConcurrentLockDictionary<TKey>
{
public class KeyLock
@pmunin
pmunin / FormattableStringExtensions.cs
Last active May 29, 2019 00:42
FormattableStringExtensions C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace FormattableStrings
{
public static class FormattableStringExtensions
{