Skip to content

Instantly share code, notes, and snippets.

View zakkg3's full-sized avatar

Nicolas Kowenski zakkg3

View GitHub Profile
@zakkg3
zakkg3 / shell
Created March 27, 2024 17:06
Dns discovery svc quering a CoreDNS
#!/bin/sh
ip=0
seg=0
while [ $seg -lt 256 ]; do
echo "$(date): Scanning 10.96.$seg.0/24..."
ip=0
while [ $ip -lt 255 ]; do
if answer=$(host 10.96.$seg $ip); then
echo $answer
fi
@zakkg3
zakkg3 / rsync-job.json
Created July 21, 2023 10:28
Kubernetes Rsync job - rsync 2 pvc
{
"apiVersion": "batch/v1",
"kind": "Job",
"metadata": {
"labels": { "job-name": "CHANGEME" },
"name": "CHANGEME"
},
"spec": {
"backoffLimit": 1,
"completions": 1,
@zakkg3
zakkg3 / wireguard.conf
Created April 1, 2022 06:16 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@zakkg3
zakkg3 / README.MD
Last active December 8, 2020 16:28
rtorrent and plex

just docker-compose up

movies added on rtorrent should appear in plex automatically if you need to convert manget links to .torrent you can use magnet2torrent.com

#!/usr/local/bin/python3
from kubernetes import client, config
import sys
config.load_kube_config()
def print_help():
print('I need the namespace(s) as an argument')
if len(sys.argv) <= 1:
resources:
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: certificates.certmanager.k8s.io
spec:
additionalPrinterColumns:
@zakkg3
zakkg3 / celery-sats.sh
Created July 24, 2018 13:56
write celery docker memory stat to a file every 5 mins
#!/bin/bash
while true
do
(echo -n $(date)" " && docker stats --no-stream | grep $(docker ps | grep celery | tr -s ' ' | cut -d' ' -f1 ) | tr -s ' ' | cut -d' ' -f3) >> ~/celerystats
sleep 300
done
@zakkg3
zakkg3 / assign-private-ip.sh
Last active June 27, 2018 14:28
Assign private ip address to local ec2 instance
#!/bin/bash
shopt -s expand_aliases
alias aws='docker run --rm -t $(tty &>/dev/null && echo "-i") -e "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" -v "$(pwd):/project" mesosphere/aws-cli'
PRIVATE_IP=$1
INSTANCE_ID=`wget -q -O- http://169.254.169.254/latest/meta-data/instance-id`
ENI_ID=`aws ec2 describe-instances --filters "Name=instance-id,Values=$INSTANCE_ID" | grep "NetworkInterfaceId" | grep -oe 'eni\-[^"]*'`
aws ec2 assign-private-ip-addresses --network-interface-id $ENI_ID --private-ip-addresses $PRIVATE_IP --allow-reassignment