Skip to content

Instantly share code, notes, and snippets.

View eramax's full-sized avatar
🎯
Focusing

Ahmed Morsi eramax

🎯
Focusing
View GitHub Profile
@eramax
eramax / NetArch.cs
Created October 26, 2021 18:37
NetArchTests
using NetArchTest.Rules;
using WebApi2.Services;
using Xunit;
/// <summary>
/// NetArchTest
/// https://github.com/BenMorris/NetArchTest
/// </summary>
namespace NetArch
{
function getHightlightCoords() {
var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
var pageRect = page.canvas.getClientRects()[0];
var selectionRects = window.getSelection().getRangeAt(0).getClientRects();
var viewport = page.viewport;
var selected = selectionRects.map(function (r) {
return viewport.convertToPdfPoint(r.left - pageRect.x, r.top - pageRect.y).concat(
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
});
@eramax
eramax / portainer_docker-compose.yml
Created February 8, 2022 19:48
portainer docker-compose.yml
version: "3.9"
services:
portainer:
image: portainer/portainer-ce:latest
ports:
- 9000:9000
container_name: portainer
# username: admin , password: 123 , hash command : htpasswd -nb -B admin 123 | cut -d ":" -f 2
command: --admin-password "$$2y$$05$$aZhNvtX9GSAIUXPbfKq6dudTMuJcJuLnwWmz2HBnBq23fAlzrAyeu" -H unix:///var/run/docker.sock
volumes:
@eramax
eramax / postgres_docker-compose.yml
Created February 8, 2022 19:49
postgres docker-compose.yml
version: "3.9"
services:
postgres:
container_name: postgres-container
image: postgres
restart: always
ports:
- '5432:5432'
volumes:
- ./db:/var/lib/postgresql/data
@eramax
eramax / Kubernetes-Nginx-Static-Web-Apps.md
Last active August 10, 2022 11:40
Single Kubernetes Nginx To Support Unlimited Static Web Apps With Their Subdomains

The Goal

I want to be able to publish every code commit of our react app.

Azure support deployment slots, which can be used but unfortunately, there is limited count of deployment slots that you can get.

The solution

By installing nginx as a deployment on kubernetes (single instance could be fine, you don't need to have an instance for each deployment) and make sure that nginx http folder is get mounted from azure file share

@eramax
eramax / my_hello_world_distro.sh
Created January 25, 2023 21:44 — forked from Daniel-Abrecht/my_hello_world_distro.sh
Shellscript to build the most minimalistic linux live CD which just starts /sbin/init from the CD root directory and outputs "Hello World!"
#!/bin/bash
# Vorhandensein der Programme prüfen
MKISOFS=( $(which genisoimage mkisofs) )
if ! [ -x "$MKISOFS" ]; then echo "genisoimage aka mkisofs is missing"; exit 1; fi
if ! [ -x "$(which gcc)" ]; then echo "gcc is missing"; exit 1; fi
if ! [ -x "$(which nasm)" ]; then echo "nasm is missing"; exit 1; fi
if ! [ -x "$(which cpio)" ]; then echo "cpio is missing"; exit 1; fi
if ! [ -x "$(which tar)" ]; then echo "tar is missing"; exit 1; fi
@eramax
eramax / readme.md
Created February 5, 2023 22:05 — forked from xanderificnl/readme.md
alpine + k3s

/etc/update-extlinux.conf

default_kernel_opts="nomodeset quiet rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory consoleblank=120"

update-extlinux && reboot

Install k3s

curl -sfL https://get.k3s.io | INSTALL_k3S_EXEC='--disable servicelb --no-deploy traefik --flannel-backend=none --disable-network-policy' sh -
@eramax
eramax / install.sh
Created February 5, 2023 22:05 — forked from iul1an/install.sh
install k3s with cilium CNI
#!/bin/bash
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='--flannel-backend=none --no-flannel' sh -s - \
--disable-network-policy \
--disable "servicelb" \
--disable "traefik" \
--disable "metrics-server"
sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config
kubectl create -f https://raw.githubusercontent.com/cilium/cilium/v1.7/install/kubernetes/quick-install.yaml
@eramax
eramax / install.sh
Created February 5, 2023 22:05 — forked from hydrz/install.sh
High Availability K3s and Kube-vip with Cilium
#!/bin/sh
set -e
set -o noglob
# Usage: ./install.sh [options]
#
# Example:
# Installing on first master node run:
# ./install --num 3 --vip 192.168.2.10 --iface eth0
# Installing on other master nodes run:
@eramax
eramax / echo.yaml
Created February 25, 2023 15:19
echo.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
spec:
replicas: 2
selector:
matchLabels:
app: echoserver
template: