Skip to content

Instantly share code, notes, and snippets.

View LwServices's full-sized avatar
🏠
Working from home

Lech Wiecierzynski LwServices

🏠
Working from home
View GitHub Profile
@LwServices
LwServices / .gitconfig
Created April 19, 2023 18:59
.gitconfig
[user]
name = Lw
email = w@gmail.com
username = lws
[credential]
helper = manager-core
[core]
editor = nano
@LwServices
LwServices / .bash_profile
Created April 19, 2023 18:55
.bash_profile
alias n='nano -w'
alias l1='ls -1'
alias ll='ls -l'
alias lr='ls -1R'
alias ff='find . -type f'
alias npp='/c/Program\ Files/Notepad++/notepad++.exe'
alias ..='cd ..'
alias wm="/c/Program\ Files\ \(x86\)/WinMerge/WinMergeU.exe"
alias sq3='winpty sqlite3.exe'
alias md5='winpty md5.exe'
@LwServices
LwServices / DI WPF-C#.md
Created June 27, 2022 16:35 — forked from sajidmohammed88/DI WPF-C#.md
Dependency injection in WPF project with .net core

Dependency injection in WPF project with .net core

Delete StartupUri="MainWindow.xaml" from App.xaml
Install packages :
Microsoft.Extensions.Configuration.Json
Microsoft.Extensions.DependencyInjection
Microsoft.Extensions.Options.ConfigurationExtensions
Add the file appsettings.json in the root of the project to use it for configuration.
public class NetworkOnMainThreadException : ApplicationException
{
public NetworkOnMainThreadException()
{
}
public NetworkOnMainThreadException(string message)
: base(message)
{
}
@LwServices
LwServices / Windows Defender Exclusions for Developer.ps1
Created August 11, 2019 05:07 — forked from odornauf/Windows Defender Exclusions for Developer.ps1
Adds Windows Defender exclusions for developers (Visual Studio, JetBrains Rider, IntellIJ Idea, Git, MsBuild, dotnet, mono etc.)
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null
$pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null
$pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null
@LwServices
LwServices / regex.cs
Last active July 13, 2019 06:21
SNAKE_CASE to PascalCase
var InString = "bla_BLA_bla";
var patternUpperCamelCase = @"(^|[_-])([a-zA-Z0-9])([a-zA-Z0-9]+)";
var pattern2 = @"((?<First>^[a-zA-Z0-9])|(?<Separator>[_-]|\s)(?<Next>[a-zA-Z0-9]))(?<Body>[a-zA-Z0-9]{0,})";
var pattern = @"((?<First>^[a-zA-Z0-9])|(?<Separator>[^a-zA-Z0-9]|\s)+(?<Next>[a-zA-Z0-9]))(?<Body>[a-zA-Z0-9]{0,})";
var result = Regex.Replace(InString, pattern, match =>
{
var sb = new StringBuilder();
if (match.Groups["First"].Success)
{
sb.Append("_");
public class Employe : INotifyPropertyChanged
{
    public int EmployeId { get; set; }
    public string EmployeName { get; set; }
    public Department EmployeDepartment { get; set; }
    //public override string ToString()
    //{
@LwServices
LwServices / ObservableDictionary.cs
Created August 4, 2017 07:53 — forked from kzu/ObservableDictionary.cs
An ObservableDictionary<TKey, TValue>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
var namen = new string[] { "Lech", "Mai", "Theo", "Xenia", "Ewa", "Andrzej" };
var d = namen.ToDictionary(k => k,v=> Regex.IsMatch(v, @"i"));
var g = namen.GroupBy(x => Regex.IsMatch(x, @"i"));
var l = namen.ToLookup(x=> Regex.IsMatch(x, @"i"));
var s = namen.Select(x => new { Key = x, Value=Regex.IsMatch(x, @"i") });
var kv = namen.Select(x => new KeyValuePair<string,bool>(x, Regex.IsMatch(x, @"i") ));
Console.WriteLine(d);
Console.WriteLine(g);