Skip to content

Instantly share code, notes, and snippets.

View 0x414c49's full-sized avatar
💪
Coding!

Ali Bahrami 0x414c49

💪
Coding!
  • ValueBlue B.V
  • Utrecht, The Netherlands
View GitHub Profile
@0x414c49
0x414c49 / ChatWindow.cs
Created January 14, 2020 09:03
ChatWindow
using Terminal.Gui;
namespace RetroChat
{
public class ChatWindow : Window
{
private readonly View _parent;
private static string _username;
private static readonly List<string> _users = new List<string>();
private static readonly List<string> _messages = new List<string>();
@0x414c49
0x414c49 / LoginWindow.cs
Last active September 10, 2021 01:15
Login Window
using System;
using Terminal.Gui;
namespace RetroChat
{
public class LoginWindow : Window
{
private readonly View _parent;
public Action<(string name, DateTime birthday)> OnLogin {get;set;}
public Action OnExit {get;set;}
@0x414c49
0x414c49 / Program.cs
Created January 13, 2020 13:10
First top window
using Terminal.Gui;
namespace RetroChat
{
class Program
{
static void Main(string[] args)
{
Application.Init();
var top = Application.Top;
@0x414c49
0x414c49 / Dockerfile
Created January 8, 2020 11:51
ASPNET Core on Alpine with minimum requirements
FROM alpine:3.9.4
# Add some libs required by .NET runtime
RUN apk add --no-cache libstdc++ libintl
EXPOSE 80
EXPOSE 443
# Copy
WORKDIR /app
@0x414c49
0x414c49 / Dockerfile
Created January 8, 2020 10:26
ASPNET Core on Alpine base image
FROM alpine:3.9.4
# Add some libs required by .NET runtime
RUN apk add --no-cache libstdc++ libintl icu
EXPOSE 80
EXPOSE 443
# Copy
WORKDIR /app
@0x414c49
0x414c49 / Dockerfile
Created January 8, 2020 08:44
Self-contained ASPNet Core App on Docker Alpine Linux base image
FROM alpine:3.9.4
# Add some libs required by .NET runtime
# https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md#troubleshooting
RUN apk add --no-cache \
openssh libunwind \
nghttp2-libs libidn krb5-libs libuuid lttng-ust zlib \
libstdc++ libintl \
icu
@0x414c49
0x414c49 / Dockerfile
Created January 7, 2020 14:07
Aspnet core deployment-1
# We only ship the published app in the image
# so we only use ASPNET runtime as the base-image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
EXPOSE 80
EXPOSE 443
# Copy
WORKDIR /app
COPY ./publish ./
@0x414c49
0x414c49 / Counter.razor
Last active January 3, 2020 12:58
Blazor debug -2
private void IncrementCount()
{
Console.WriteLine(currentCount);
if(currentCount > 10)
currentCount = 0;
currentCount++;
}
@0x414c49
0x414c49 / Counter.razor
Created January 3, 2020 10:53
Blazor debug - 1
@page "/counter"
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
@0x414c49
0x414c49 / Program.cs
Created January 2, 2020 14:04
Complete and working sample of CLI
using McMaster.Extensions.CommandLineUtils;
using System;
using System.IO;
namespace CSVUtil
{
class Program
{
public static void Main(string[] args)
{