Skip to content

Instantly share code, notes, and snippets.

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as build
WORKDIR /app
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64
COPY . .
RUN dotnet publish -c Release -r linux-musl-x64 -o out --no-restore
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as runtime
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as build
WORKDIR /app
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64
COPY . .
RUN dotnet publish -c Release -r linux-musl-x64 -o out --no-restore
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-alpine as runtime
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as build
WORKDIR /app
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64
COPY . .
RUN dotnet publish -c Release -r linux-musl-x64 -o out --no-restore
FROM mcr.microsoft.com/dotnet/core/runtime-deps:2.2-alpine as runtime
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as build
WORKDIR /app
COPY *.csproj .
RUN dotnet restore -r linux-musl-x64
FROM build as publish
WORKDIR /app
COPY . .
#add IL linker package
@mafshin
mafshin / singleton-csharp.cs
Last active March 21, 2020 06:12
Singleton C#
namespace DataLib
{
public class DataManager
{
public void Run()
{
DataProvider.Instance.RunQuery();
}
}
@mafshin
mafshin / Program.cs
Created November 12, 2021 06:04
Sample Data Generator for Task #1 (.NET 6)
// See https://aka.ms/new-console-template for more information
int count = 6;
var products = Enumerable.Range(1001, 20).ToArray();
for (int i = 1; i <= count; i++)
{
int recordsCount = (int)Math.Pow(10, i);
var fileName = $"Data/Data{recordsCount}.csv";
Directory.CreateDirectory("Data");
@mafshin
mafshin / HappyBirthday.py
Created March 5, 2022 08:46
A Happy Birthday program for developers
from datetime import datetime
firstName = input('Enter your first name: ')
lastName = input('Enter your last name:');
birthdateInput = input('Enter your birthdate: YYYY-MM-DD: (e.g 2003-12-04):');
birthdate = datetime.fromisoformat(birthdateInput);
age = datetime.now() - birthdate
days = age.days
@mafshin
mafshin / sort_by_word.py
Created July 23, 2022 12:28
Sort a list by a word
a = ['f', 'a', 'f', 's', 'o','a', 'd', 'm']
word = 'sofa'
a_sorted = sorted(a, key=lambda x: x)
print(a_sorted)
a_sorted_by_word = sorted(a, key=lambda x: word.find(x))
print(a_sorted_by_word)
@mafshin
mafshin / all-combinations.py
Created October 4, 2022 06:33
Python All Combinations
from functools import reduce
list3 = [
['S1', 'S2'],
['O1', 'O2'],
['F1'],
['A1', 'A2']
]
result = list3[0]
@mafshin
mafshin / config
Created October 23, 2022 17:19
Github SSH Config (with alias and port)
Host *
IgnoreUnknown AddKeysToAgent,UseKeychain
UseKeychain yes
AddKeysToAgent yes
IdentityFile c:\users\USERNAME\.ssh\id_ed25519
## Uncomment if you want to switch SSH port
## Note that alias is 'gh' so you can now clone with
## git clone gh:GITHUB_USERNAME/REPO_NAME.git
# Host gh