This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package evaluation; | |
import com.ezylang.evalex.EvaluationException; | |
import com.ezylang.evalex.Expression; | |
import com.ezylang.evalex.config.ExpressionConfiguration; | |
import com.ezylang.evalex.data.EvaluationValue; | |
import com.ezylang.evalex.functions.AbstractFunction; | |
import com.ezylang.evalex.functions.FunctionParameter; | |
import com.ezylang.evalex.parser.Token; | |
import lombok.extern.slf4j.Slf4j; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This script provides three modes of operation: | |
1. Converts a given string to its hexadecimal representation. | |
2. Decodes a given hexadecimal string back to its original UTF-8 representation. | |
3. Renames files in a given directory by encoding the part of the filename before the first '.' or '_'. | |
.PARAMETER InputString | |
A string that will be converted to hexadecimal encoding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$process = Get-Process | Where-Object { $_.MainWindowTitle -like "*xxx*" } | |
if ($process) { | |
# Get the executable file path | |
$exePath = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = $($process.Id)" | Select-Object -ExpandProperty ExecutablePath | |
Write-Output "Executable Path: $exePath" | |
} else { | |
Write-Output "No process found with the specified window title." | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example2; | |
import com.fasterxml.jackson.core.*; | |
import com.fasterxml.jackson.databind.*; | |
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
import java.io.IOException; | |
import java.util.*; | |
import java.util.stream.Collectors; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findCodePointsLikeAtoZ() { | |
const targetLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
const normalizationResults = {}; | |
// Initialize the dictionary for each letter | |
for (const letter of targetLetters) { | |
normalizationResults[letter] = []; | |
} | |
// Iterate over all Unicode code points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
var now = DateTimeOffset.UtcNow; | |
TryGenerate(() => Guid.NewGuid(), " v4"); | |
TryGenerate(() => Guid.CreateVersion7(now), " v7"); | |
TryGenerate(() => CreateVersion7(now), "MBv7"); | |
TryGenerate(() => Ulid.NewUlid(now).ToGuid(), "Ulid"); | |
static void TryGenerate(Func<Guid> generator, string name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://aka.ms/new-console-template for more information | |
using FluentResults; | |
//1. simple | |
Console.WriteLine(Divide(5, 0)); | |
//2. fluent | |
var fluent = Result.Fail("error message 1") | |
.WithError("error message 2") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://aka.ms/new-console-template for more information | |
using ConsoleApp1; | |
var nameEntities = new[] { "", null, "Dawid", "Kacper", "Wojciech", "Michał M", "Michał B", "Rafał", "Anna", "Floris" } | |
.Select(CreateUser).ToList(); | |
var index = 0; | |
foreach (var ne in nameEntities) | |
{ | |
if (ne.TryGetValue(out var u)) Console.WriteLine($"{index++}. User created: {u}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
namespace Net8.Features; | |
[Order(9)] | |
internal class InterceptorsLogging : IShowable | |
{ | |
public void Show() | |
{ | |
var todo = new TodoApi(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using BenchmarkDotNet.Attributes; | |
using Serilog; | |
namespace TestLoggerCallsPerf; | |
/*Console | |
| Method | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio | | |
|----------- |---------:|--------:|---------:|------:|--------:|----------:|------------:| | |
| ParamsArgs | 477.0 ms | 8.56 ms | 8.01 ms | 1.00 | 0.00 | 3.75 MB | 1.00 | |
NewerOlder