Skip to content

Instantly share code, notes, and snippets.

View uladz-zubrycki's full-sized avatar

Uladz Zubrycki uladz-zubrycki

View GitHub Profile
@uladz-zubrycki
uladz-zubrycki / clone.yml
Created November 16, 2021 09:05
Github Action: Clone PR to another repository
# Github action to clone PR to another repository.
name: clone-pr
on:
pull_request:
types: [ opened ]
branches: [ main ]
jobs:
clone:
@uladz-zubrycki
uladz-zubrycki / Disposable.cs
Last active October 16, 2021 16:09
Disposable delegate
public static class Disposable
{
public static IDisposable Create(Action dispose) =>
new DisposableAction(dispose);
public static IAsyncDisposable Create(Func<ValueTask> dispose) =>
new AsyncDisposableAction(dispose);
private sealed class DisposableAction: IDisposable
@uladz-zubrycki
uladz-zubrycki / EFCoreHacks.cs
Created October 14, 2021 09:20
EFCore 3 full scan workaround
// Workaround for https://github.com/dotnet/efcore/issues/17936
// Requires https://www.nuget.org/packages/LinqKit/
// EFCoreHacks.Rewrite is a custom "expression optimizer" for LinqKit, which should be set to LinqKitExtension.QueryOptimizer
// I do it in my DbContext static constructor. It allows us to use SelectEF and FirstOrDefaultEF extensions methods,
// which are to be rewritten before the expression is passed to EF query translator. Those force EF to use OUTER APPLY with proper predicate.
//
// SelectEF(exp) -> .Select(exp).Take(Int32.MaxValue).ToArray();
// FirstOrDefaultEF -> .Take(1).ToArray().FirstOrDefault();
//
@uladz-zubrycki
uladz-zubrycki / hotkeys.reg
Created April 6, 2021 12:54
Disable windows hotkeys
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"DisabledHotkeys"="Q"
@uladz-zubrycki
uladz-zubrycki / Microsoft.PowerShell_profile.ps1
Last active February 24, 2025 11:59
~\Documents\PowerShell
Set-PSReadLineOption -Colors @{
"Default" = [ConsoleColor]::Black
"Parameter" = [ConsoleColor]::Black
"Type" = [ConsoleColor]::DarkBlue
"Number" = [ConsoleColor]::Magenta
"String" = [ConsoleColor]::Magenta
"Command" = [ConsoleColor]::Magenta
"Comment" = [ConsoleColor]::Yellow
"Variable" = [ConsoleColor]::Green
"Keyword" = [ConsoleColor]::Blue
@uladz-zubrycki
uladz-zubrycki / settings.json
Last active February 24, 2025 11:58
Windows terminal settings
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions": [
{
"command": {
"action": "copy",
"singleLine": false
},
"id": "User.copy.644BA8F2",
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#325CC0",
"properties": {
@uladz-zubrycki
uladz-zubrycki / settings.json
Created February 7, 2021 16:11
VS code theme customizations
"workbench.colorTheme": "Visual Studio Light",
"workbench.colorCustomizations": {
"editor.background": "#F7F7F7",
"editor.foreground": "#000",
"editor.lineHighlightBackground": "#F0F0F0",
"editor.selectionBackground": "#BFDBFE",
"editor.selectionHighlightBackground": "#E0E0E0",
"panel.background": "#F0F0F0",
"sideBar.background": "#F0F0F0",
"editorGroupHeader.tabsBackground": "#F0F0F0",