Skip to content

Instantly share code, notes, and snippets.

View shearluck's full-sized avatar

Noel Jarencio shearluck

  • Philippines
View GitHub Profile
@shearluck
shearluck / k3s-setup.sh
Created April 30, 2019 02:40
K3s Centos 7 setup
echo 'net.netfilter.nf_conntrack_max=65528
net.ipv4.netfilter.ip_conntrack_max=65535' >> /etc/sysctl.conf
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
sysctl -p /etc/sysctl.conf
curl -sfL https://get.k3s.io | sh -
@shearluck
shearluck / pod.yaml
Last active October 17, 2022 07:44
Kubernetes k3s, EC2 spot instance, ECR, Private registry
apiVersion: v1
kind: Pod
metadata:
name: <app-name>
labels:
app: <app-name>
spec:
containers:
- name: <app-name>
image: <account>.dkr.ecr.us-west-2.amazonaws.com/<app-name>:latest
mkdir .auth
# Create basic auth
docker run \
--entrypoint htpasswd \
registry:2 -Bbn testuser testpassword > .auth/htpasswd
# Make sure to serve this into an HTTPS load balancer/frontend
docker run -d \
-p 5000:5000 \
@shearluck
shearluck / qemu-mac-host.sh
Last active December 3, 2019 15:19
arch-mac-qemu
qemu-system-x86_64 -m 2048 -accel hvf -smp 2 -net nic -net user -device VGA,vgamem_mb=128,edid=on,xres=1680,yres=1050 -hda arch.img
# Mac host, access usb
-device pci-ohci
# Mac host, access usb raw storage device
-hdb /dev/disk2
@shearluck
shearluck / cloud-init.sh
Created April 23, 2020 09:20 — forked from ebal/cloud-init.sh
Cloud-init example using a Generic Cloud CentOS-7 on a libvirtd qmu/kvm lab
#!/bin/sh
if [ "$EUID" -ne 0 ]; then
echo -e "\nPlease run as root\neg. sudo $0 \n"
exit
fi
GITHUB_USERNAME="ebal"
cd `mktemp -d`
@shearluck
shearluck / password_generator.sh
Created May 11, 2020 08:34
Linux random password generator
LEN=$1
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c$LEN
qemu-img create -f qcow2 /mount/path/disk.qcow2 -o preallocation=metadata 20G
sudo virsh attach-disk domain --source /mnt/files/VM/work/minikube.qcow2 --target vdc --cache none --persistent