Skip to content

Instantly share code, notes, and snippets.

View haamond's full-sized avatar
🎯
Focusing

Hamond haamond

🎯
Focusing
  • Relex Solutions
  • Helsinki
View GitHub Profile
@haamond
haamond / ClaimJsonConverter.cs
Created July 18, 2023 09:30
Claim's JsonConverter for System.Text.Json
using System.Security.Claims;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace System.Security.Claims.Serialization;
public class ClaimJsonConverter : JsonConverter<Claim>
{
// Supported properties:
private const string Issuer = "Issuer";

Linkfire Data Ingestion solution

The solution divides the provided files into small pieces (1.000.000 lines) and then imports them to a relational database(MySQL) and aggregate it(index it) to the ElasticSearch.

Infrastructures and requirements

  • Docker as the container.
  • Mysql and Elasticsearch images.
  • .NET Core v3.1 SDK

Projects

The solution includes 5 projects:

@haamond
haamond / ValidationBehavior.cs
Created October 30, 2019 10:23
Async FluentValidation MediatR Behavior
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FluentValidation;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
@haamond
haamond / MongoDbBackup.ps1
Created October 30, 2016 12:17
A Power Shell that backups mongoDB all collections and compress it into a zip file with help of .NET framework
function ZipFiles( $zipfilename, $sourcedir )
{
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, $zipfilename, $compressionLevel, $False)
}
$date = Get-Date -UFormat %Y-%m-%d;
$backupFolder = $date;
$basePath = "C:\MongoBackup";