Skip to content

Instantly share code, notes, and snippets.

View neumachen's full-sized avatar
🏠
Working from home

Kareem H neumachen

🏠
Working from home
  • Bergen, Norway
  • 21:20 (UTC -12:00)
View GitHub Profile
#!/bin/zsh
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
@neumachen
neumachen / docker-swarm-architecture.md
Created December 11, 2024 14:35 — forked from scyto/docker-swarm-architecture.md
My Docker Swarm Architecture
@neumachen
neumachen / turn_off_switches_at_sunrise.yaml
Last active November 16, 2023 23:22
Turn Off Switches At Sunrise
blueprint:
name: Turn Off Switches At Sunrise
description: Turn off the following switches at sunrise
domain: automation
input:
# Create a variable for identifying the light to act upon
target_switch:
name: Switches
description: This is the switch (or switches) that will be deactivated at sunrise
# Use a selector, to pick the light(s)
@neumachen
neumachen / turn_on_switches_at_sunset.yaml
Last active November 16, 2023 23:21
Turn on switches at Sunset
blueprint:
name: Turn On Switches At Sunset
description: Turn on the following switches at sunset
domain: automation
input:
# Create a variable for identifying the light to act upon
target_switch:
name: Switches
description: This is the switch (or switches) that will be activated at sunset
# Use a selector, to pick the light(s)
@neumachen
neumachen / load_dotenv.sh
Created October 21, 2023 21:14 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@neumachen
neumachen / list.go
Created September 27, 2023 06:09 — forked from pje/list.go
A simple golang implementation of a doubly-linked list that supports generics.
// A generic doubly-linked list
package list
// the zero value is ready to use.
type List[T any] struct {
root Element[T]
Len int
}

The following snippet contains an example for GoLang Generics for Structs:

package main

import "fmt"

// Structs definition
type ObjectOne struct {
	Name string      `json:"name"`
@neumachen
neumachen / nvme_mount.md
Created April 16, 2023 19:46 — forked from a-maumau/nvme_mount.md
how to mount m.2 ssd/hdd
@neumachen
neumachen / multi-arch-docker-ci.sh
Created March 5, 2023 02:24 — forked from ArturKlauser/multi-arch-docker-ci.sh
Building Multi-Architecture Docker Images With Buildx
#!/bin/bash
# (c) 2020 [email protected]
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# This script installs support for building multi-architecture docker images
# with docker buildx on CI/CD pipelines like Github Actions or Travis. It is
# assumed that you start of with a fresh VM every time you run this and have to
# install everything necessary to support 'docker buildx build' from scratch.
#
# Example usage in Travis stage:
@neumachen
neumachen / docker-traefik-label.txt
Created July 4, 2022 18:48 — forked from ismailyenigul/docker-traefik-label.txt
docker labels for traefik reverse proxy multiple ports in a single container with different domain names
--label "traefik.enable=true" \
--label "traefik.protocol=http" \
--label "traefik.first.port=80" \
--label "traefik.first.frontend.rule=Host:web1.example.com" \
--label "traefik.second.port=8080" \
--label "traefik.second.frontend.rule=Host:web2.example.com" \
Above labels will allow us to forward web1.example.com to docker container port 80 and web2.example.com to same container's port 8080