Skip to content

Instantly share code, notes, and snippets.

View iul1an's full-sized avatar

Iulian Mandache iul1an

View GitHub Profile
@iul1an
iul1an / pre-push
Created August 14, 2023 21:03
git pre-push hook: do not allow push to master branch
#!/bin/sh
# The remote repo
remote="$1"
url="$2"
# Check each commit that's being pushed
while read local_ref local_sha remote_ref remote_sha
do
if [ "$remote_ref" = "refs/heads/master" ]; then
@iul1an
iul1an / kubectl-eks
Created August 11, 2023 11:48
Kubectl plugin for EKS clusters
#!/bin/bash
function help() {
echo "Usage: $(basename "$0") [COMMAND] [OPTIONS]"
echo
echo "A utility script to retrieve and display information about EKS clusters."
echo
echo "Commands:"
echo " node, nodes Get detailed information about nodes in the cluster."
echo
@iul1an
iul1an / bootstrap.sh
Last active August 16, 2023 10:31
kind+gitea+argocd
#!/bin/bash
set -euo pipefail
# create cluster
cat <<EOF | kind create cluster --config=-
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
@iul1an
iul1an / browser-chooser.desktop
Last active March 28, 2023 15:49
Simple browser selector for Linux, requires yad to display GTK+ dialog
[Desktop Entry]
Name=Browser Chooser
GenericName=Browser Chooser
Comment=Select a browser to access the Internet
Categories=Network;WebBrowser;
Icon=browser
Type=Application
Exec=browser-chooser.sh --url %u
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
@iul1an
iul1an / choosy
Created March 19, 2023 19:20 — forked from cesarolea/choosy
Open browser based off of certain rules (like choosy for macOS)
#!/bin/bash
URL=$1
DOMAIN=$(echo "$URL" | awk -F[/:] '{print $4}')
## Domain starts with
if [[ $DOMAIN =~ $(echo ^\($(paste -sd'|' /home/your-user/.config/url-start.txt)\)$) ]]; then
chromium-browser "$URL" & disown
elif [[ $DOMAIN =~ $(echo ^\($(paste -sd'|' /home/your-user/.config/url-is.txt)\)$) ]]; then
firefox "$URL" & disown
# desc: open a new shell using aws-vault and use fzf to choose a profile if no profile is provided as argument
# desc: append "--stdout" to print the SSO login link instead of automatically opening a browser
# shell: zsh
aws-vault () {
local ARGS=("$@")
if [[ $1 == "exec" ]]; then
if [[ $# -eq 1 ]]; then
local AWS_PROFILE
AWS_PROFILE="$(command aws-vault list --profiles | fzf)"
ARGS=("exec" "$AWS_PROFILE" "--stdout")
@iul1an
iul1an / start.sh
Last active February 26, 2023 02:20
Minikube using KVM2 driver on Ubuntu
#!/bin/bash
set -euo pipefail
cat <<'EOF'> /tmp/minikube-br0.xml
<network>
<name>minikube</name>
<uuid>ec47d11f-87ba-4231-b38d-0efedd392b84</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
#!/bin/bash
# variables
export K3S_KUBECONFIG_MODE="666"
# install K3s
curl -sfL https://get.k3s.io | sh -s - \
--disable-network-policy \
--disable "servicelb" \
--disable "traefik" \
@iul1an
iul1an / install.sh
Created June 17, 2020 19:10
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