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();
//
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\GitExtensions2]
@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 / config.xml
Last active February 17, 2021 14:35
Perfmonbar setup
<?xml version="1.0" encoding="utf-8"?>
<perfbar>
<counters>
<!-- you can run `typeperf -q>counters.txt` to list all available counters on your system -->
<counter name="cpu" value="\Processor Information(*)\% Processor Time"/>
<counter name="mem" value="\Memory\% Committed Bytes In Use"/>
<counter name="netin" value="\Network Interface(*)\Bytes Received/sec"/>
<counter name="netout" value="\Network Interface(*)\Bytes Sent/sec"/>
</counters>
<pages>
@uladz-zubrycki
uladz-zubrycki / Microsoft.PowerShell_profile.ps1
Last active April 9, 2021 11:18
~\Documents\PowerShell
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme pure-custom
Set-PSReadLineOption -Colors @{
"Default" = [ConsoleColor]::Black
"Parameter" = [ConsoleColor]::Black
"Type" = [ConsoleColor]::DarkBlue
"Number" = [ConsoleColor]::Magenta
"String" = [ConsoleColor]::Magenta
@uladz-zubrycki
uladz-zubrycki / settings.json
Last active April 9, 2021 11:20
Windows terminal settings
"copyOnSelect": true,
"profiles": {
"defaults": {
"colorScheme": "Solarized Light Custom",
"fontFace": "Consolas NF",
"fontSize": 11
},
"list": [
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
{
"final_space": false,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{if .Root}}(Admin){{end}} {{.Path}}",
"blocks": [
{
"type": "newline",
"alignment": "",
"horizontal_offset": 0,
@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",