Skip to content

Instantly share code, notes, and snippets.

View jtabuloc's full-sized avatar

jtabuloc jtabuloc

View GitHub Profile
@jtabuloc
jtabuloc / add-remove-ip-in-azure-storage-account.ps1
Last active June 25, 2023 14:03
Add or Remove IP address of running machine in Azure Account Storage network firewall
#####################################################################################
#
# Script that will get IP address machine and add/remove in storage account firewall
# Action Parameter: Add/Remove
#
#####################################################################################
param(
[string]$AccountStorageName,
[string]$Action
@jtabuloc
jtabuloc / Program.cs
Last active August 16, 2022 04:55
Multiple Sql databases with one interface using factory pattern
using Microsoft.Extensions.DependencyInjection;
using System;
namespace GenericSqlDatabseServiceFactory
{
internal class Program
{
static void Main(string[] args)
{
var serviceCollection = new ServiceCollection();
@jtabuloc
jtabuloc / AppExtensions.cs
Last active August 7, 2022 03:38
Transactional and Non-Transactional API Request middleware with unit of work
namespace Customer.WebApi.Extensions
{
public static class AppExtensions
{
public static void UseUnitOfWorkMiddleware(this IApplicationBuilder app)
{
app.UseMiddleware<UnitOfWorkMiddleware>();
}
}
}
@jtabuloc
jtabuloc / BaseApiController.cs
Last active August 7, 2022 02:48
Generic MediatR Request Handler with Generic Repository
namespace Customer.WebApi.Controllers
{
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
public abstract class BaseApiController<TDto> : ControllerBase where TDto : class, new()
{
private IMediator _mediator;
protected IMediator Mediator => _mediator ??= HttpContext.RequestServices.GetService<IMediator>();
[HttpDelete("Remove")]
# This simple PowerShell script will copy one or more Azure storage table from one location into another azure storage table
#
# Dependencies :
# https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy
# https://docs.microsoft.com/en-us/powershell/azure/overview?view=azps-1.6.0
#
# Usage :
# Copy-AzureStorageTable -SrcStorageName "" -SrcAccessKey "" -DstStorageName "" -DstAccessKey "" -IncludeTable All
# Copy-AzureStorageTable -SrcStorageName "" -SrcAccessKey "" -DstStorageName "" -DstAccessKey "" -IncludeTable Table1,Table2,Table3
@jtabuloc
jtabuloc / Program.cs
Last active July 17, 2019 16:54
This is a very simple solution to get around with azure scheduled web job idle time (WEBJOBS_IDLE_TIMEOUT).
namespace ScheduleWebJobHandler
{
/// <summary>
/// Example of console app that use WebJobTimeoutHandler
/// </summary>
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Scheduled Job started.");
@jtabuloc
jtabuloc / BaseTypeMapper.cs
Last active June 11, 2018 04:55
This custom column attribute mapper will serve only as personal copy and an example.
using Dapper;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace ColumnAttrMapper
{
public class BaseTypeMapper : SqlMapper.ITypeMap
{
private readonly IEnumerable<SqlMapper.ITypeMap> _mappers;