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 / iischeatsheet.bat
Created March 3, 2017 18:53 — forked from jcefoli/iischeatsheet.bat
IIS Websites and Apppools Delete/Import/Export Cheat Sheet
REM Delete all Websites
%windir%\system32\inetsrv\appcmd list site /xml | %windir%\system32\inetsrv\appcmd delete site /in
REM Delete all App Pools
%windir%\system32\inetsrv\appcmd list apppool /xml | %windir%\system32\inetsrv\appcmd delete apppool /in
REM Export all the Application Pools:
%windir%\system32\inetsrv\appcmd list apppool /config /xml > C:\apppools.xml
REM Import all the Application Pools:
@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
using System;
using System.Buffers;
using System.IO.Pipelines;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
version: '3'
services:
sqlserver2019:
image: mcr.microsoft.com/mssql/server:2019-CTP3.1-ubuntu
environment:
ACCEPT_EULA: Y
SA_PASSWORD: SqlServer2019!
ports:
- "41434:1433"
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Assinaturas de Feeds via Grover Podcast</title>
<dateCreated>2019-07-23T17:52:47</dateCreated>
<dateModified>2019-07-23T17:52:47</dateModified>
</head>
<body>
<outline text="Castálio Podcast" type="rss" xmlUrl="http://feeds.feedburner.com/CastalioPodcastMP3" htmlUrl="http://feeds.feedburner.com/CastalioPodcastMP3" />
<outline text="PodProgramar | Mundo Podcast" type="rss" xmlUrl="https://mundopodcast.com.br/podprogramar/feed/" htmlUrl="https://mundopodcast.com.br/podprogramar/feed/" />
@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 =>