Skip to content

Instantly share code, notes, and snippets.

View gpproton's full-sized avatar
🎯
Focusing

Godwin Peter .O gpproton

🎯
Focusing
View GitHub Profile
@gpproton
gpproton / osm-data-merge.py
Created January 29, 2025 15:48
A basic utility for pulling and merging osm data for countries
# Copyright (c) 2025 <Godwin peter. O>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@gpproton
gpproton / auto-header.lua
Created December 10, 2024 22:15
Using auto-header with LazyVim to automatically create or update
-- NOTE: Ensure you update placeholder values
-- Create file in the location below
-- ~/.config/nvim/lua/plugins/auto-header.lua
-- Then sync lazyVim
Core_data = {
author_name = "<Your Name>",
author_mail = "<[email protected]>",
company = "<Your Company>",
}
@gpproton
gpproton / .tmux.conf
Last active January 30, 2025 15:20
A quick and effective tmux config for an effective development environment on my arch linux workstation
set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal 'screen-256color'
set -g mouse on
# Very important change prefix key bindings
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Move status bar to top
@gpproton
gpproton / simple_background_tasks.py
Last active December 7, 2024 16:27
A simple and standalone script for Long-Running/Background Tasks with Python & asyncio
#!/usr/bin/env python3
'''
Copyright (c) 2024 Godwin Peter .O
Licensed under the MIT License
you may not use this file except in compliance with the License.
https://opensource.org/license/mit
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@gpproton
gpproton / resolver.py
Last active December 7, 2024 16:26
Quick script for resolving the routes distance and ETA using only simple names of locations
#!/usr/bin/env python3
"""
Copyright (c) 2024 Godwin Peter .O
Licensed under the MIT License
you may not use this file except in compliance with the License.
https://opensource.org/license/mit
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,

Read Part 1: MediatR vs MassTransit Mediator - Differences

The MassTransit Mediator implementation is more powerful than MediatR implementation, but also more complicate to use. Unit Testing a MassTransit Consumer is not a nice experience.

In this article I will propose some techniques to simplify the MassTransit Consumer and to make them look as straight forward as a MediatR handler.

Case study

We will study a very common use case (the most common use case which I can think of):

Why mediator?

In a ASP.NET Web application. You don't need mediator

  • If you prefers to make controlers depends directly to the Application Codes instead of indirectly via the Mediator.
  • If you prefers to make a normal ASP.NET Web Application instead of a Mediator Application

Frankly it is not a Bad choice, no need to use a Mediator framework or make a Mediator Application just because everyone did.. Though, There are benefits in making a Mediator Application:

  • Event sourcing (Messages broadcast), CQS pattern..
  • Decouple the Controler (presentation) from Application codes, so that you could swap the presentation technology. For eg, if you make a "MassTransit" application, then you can swap the presentation layer to Mediator or RabbitMQ, or Grpc.. => you are not to be sticked with or limited by ASP.NET presentation => but rather sticked with and limited by your mediator framework!
@gpproton
gpproton / Segment.xaml
Last active February 15, 2025 05:09
A basic dotnet MAUI sample segment control example using BindableLayout
<!-- Working code -->
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XClaim.Mobile.Views.Segment"
x:Name="this">
<Border Padding="3" StrokeThickness="0" BackgroundColor="{DynamicResource Tertiary}">
<Border.StrokeShape>
<RoundRectangle>
<RoundRectangle.CornerRadius>
@gpproton
gpproton / importing.module.ts
Created August 13, 2022 00:49 — forked from evolkmann/importing.module.ts
Create Nest.js modules with custom config
import { Module } from '@nestjs/common';
import { MyLibModule } from './my-lib.module';
@Module({
imports: [
MyLibModule.register({ name: 'Enzo' }),
]
})
export class ImportingModule {}
@gpproton
gpproton / android-backup-apk-and-datas.md
Created April 15, 2022 13:50 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

Fetch application APK