Skip to content

Instantly share code, notes, and snippets.

View leonardochaia's full-sized avatar
🔐
8DB5 11D9 818C 66E2 75B1 0AA7 FDC3 6AF9 DC90 4C12

Leonardo Chaia leonardochaia

🔐
8DB5 11D9 818C 66E2 75B1 0AA7 FDC3 6AF9 DC90 4C12
View GitHub Profile
using AstonishingLab.Core.NHibernate;
using Microsoft.Owin;
using NHibernate;
using NHibernate.Context;
using Owin;
using System;
using System.Threading.Tasks;
namespace AstonishingLab.Core.Owin
{
@leonardochaia
leonardochaia / IServiceCollectionCookieExtensions.cs
Created March 7, 2018 18:17
.Net Core Per Request Cookie Configuration
using System;
using AstonishingLab.MultiTenancy;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.DependencyInjection
{
public static class IServiceCollectionCookieExtensions
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://foo.localhost:5000/
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://foo.localhost:5000/
info: Microsoft.AspNetCore.NodeServices[0]
http://foo.localhost:5000/api/SampleData/WeatherForecasts
Microsoft.AspNetCore.NodeServices:Information: http://foo.localhost:5000/api/SampleData/WeatherForecasts
fail: Microsoft.AspNetCore.NodeServices[0]
HttpErrorResponse {
headers: HttpHeaders { normalizedNames: Map {}, lazyUpdate: null, headers: Map {} },
status: 0,
@leonardochaia
leonardochaia / AsyncAwaitDeadlockTests.cs
Created May 16, 2018 16:22
C# MVC Controller with deadlock scenarios using Async/Await
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace Test {
public class IndexController : Controller {
public async Task<string> AsyncString()
{
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@leonardochaia
leonardochaia / gist:dbcde9652889fc7a9ab9581c5f58004a
Created June 9, 2020 02:48 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@leonardochaia
leonardochaia / Dockerfile
Created April 17, 2024 16:47
ArgoCD Kustomize Plugin Docker KRM
# plugin-image/Dockerfile
FROM alpine:3.19
RUN apk update && apk add --no-cache \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
kustomize podman
RUN ln -s /usr/bin/podman /usr/bin/docker \
&& adduser -h /home/argocd -s /bin/sh -G ping -u 999 -D argocd \
&& echo 'argocd:165536:65536' >> /etc/subuid \