Skip to content

Instantly share code, notes, and snippets.

View alexsandro-xpt's full-sized avatar

Alexsandro Souza Pereira alexsandro-xpt

View GitHub Profile
@alexsandro-xpt
alexsandro-xpt / server.cs
Created May 15, 2021 17:09 — forked from davidfowl/server.cs
Simplified ASP.NET Core app exploration
#!/usr/bin/env dotnet run
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
var connString = config["connectionString"] ?? "Data Source=todos.db";
builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString));
builder.AddSqlite<Todo>(connString) // Higher level API perhaps?
var app = builder.Build();
@alexsandro-xpt
alexsandro-xpt / Multitenancy.cs
Created January 21, 2021 19:51 — forked from davidfowl/Multitenancy.cs
Multitenancy
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
/*
- Don't need to support different services per tenant.
- Tenant services lifetime outlasts the request.
hostname elliot-01
echo elliot-01 > /etc/hostname
bash
curl -fsSL https://get.docker.com | bash
docker version
docker ps
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
apt-get update
apt-get install kubelet kubectl kubeadm
version: '3'
services:
sqlserver2019:
image: mcr.microsoft.com/mssql/server:2019-CTP3.1-ubuntu
environment:
ACCEPT_EULA: Y
SA_PASSWORD: SqlServer2019!
ports:
- "41434:1433"
@alexsandro-xpt
alexsandro-xpt / Dockerfile
Created July 16, 2019 21:18 — forked from kevnord/Dockerfile
Debugging .NET Core in Docker Container with Visual Studio Code. Based on https://github.com/Microsoft/generator-docker/issues/130#issuecomment-287222915
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
# DEBUG
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS debug
WORKDIR /app
@alexsandro-xpt
alexsandro-xpt / Program.cs
Created July 1, 2019 11:13 — forked from davidfowl/Program.cs
A minimal fully asynchronous C# ASP.NET Core 3.0 application with routing (learn more about ASP.NET Core here https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.0)
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
@alexsandro-xpt
alexsandro-xpt / setup.sh
Created May 6, 2019 17:40 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
@alexsandro-xpt
alexsandro-xpt / 1.cs
Created March 10, 2019 02:27 — forked from vkhorikov/1.cs
Value Object
public abstract class ValueObject<T>
where T : ValueObject<T>
{
public override bool Equals(object obj)
{
var valueObject = obj as T;
if (ReferenceEquals(valueObject, null))
return false;
@alexsandro-xpt
alexsandro-xpt / .gitconfig
Created August 14, 2018 20:25 — forked from giggio/_latest.md
My .gitconfig and .gitattributes
[user]
name = Giovanni Bassi
email = giggio@email
[diff]
indentHeuristic = true
submodule = log
[color]
diff = always
interactive = always
status = always