Skip to content

Instantly share code, notes, and snippets.

View zdk's full-sized avatar
:octocat:

Di Warachet S. zdk

:octocat:
  • Thailand
  • 09:06 (UTC +07:00)
View GitHub Profile
❯ cat Dockerfile
FROM docker.io/python:alpine
WORKDIR /content
RUN apk add curl
RUN curl -fsSL https://github.com/norouter/norouter/releases/latest/download/norouter-$(uname -s)-$(uname -m).tgz | tar xzvC /usr/local/bin
RUN echo '<!DOCTYPE html><html><head><title>Hello</title></head><body><h1>Hello, world!</h1></body></html>' > index.html
CMD ["python3", "-m", "http.server", "80", "--bind", "0.0.0.0"]
❯ cat norouter.yaml
hosts:
@zdk
zdk / ki-coverage.json
Last active June 12, 2025 14:48
ki-converage
{"label":"Coverage","message":"25.0%","schemaVersion":1,"color":"red"}
@zdk
zdk / bashrc
Created December 18, 2024 10:46
function apt-history(){
case "$1" in
install)
cat /var/log/dpkg.log | grep 'install '
;;
upgrade|remove)
cat /var/log/dpkg.log | grep $1
;;
rollback)
cat /var/log/dpkg.log | grep upgrade | \
#!/bin/bash
# Update system packages
apt-get update
apt-get upgrade -y
# Install Apache web server
apt-get install -y apache2
# Add PHP repository and install PHP 8.2
@zdk
zdk / basic.sh
Last active November 5, 2024 11:02
apt update
apt upgrade
echo "PubkeyAuthentication yes
PasswordAuthentication yes" >> /etc/ssh/sshd_config
systemcl restart ssh
sed -i '/^%sudo/c\%sudo ALL=(ALL) NOPASSWD:ALL' /etc/sudoers
usermod -aG sudo <user>
usermod -s /bin/bash <user>
@zdk
zdk / .bashrc
Last active November 6, 2024 02:07
#!/bin/sh
alias ll='ls -la'
# Editor: VIM
export EDITOR='nvim'
export VISUAL='nvim'
alias k=kubectl
alias tf='terraform'
alias i='/sbin/ifconfig'
@zdk
zdk / query_srv_record.tsx
Last active August 14, 2024 14:59
Test SRV record query with Bun
import * as dns from "node:dns";
import { $ } from 'bun';
const addrs = await dns.promises.resolveSrv("_web1._tcp.mydomain.local");
console.log(addrs);
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
docker pull registry.k8s.io/ingress-nginx/controller:v1.8.1
docker pull registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20230407
kind load docker-image -n dev registry.k8s.io/ingress-nginx/controller:v1.8.1
kind load docker-image -n dev registry.k8s.io/ingress-nginx/kube-webhook-certgen:v20230407
@zdk
zdk / create-cluster.sh
Last active August 5, 2024 12:59
kind cluster
cat <<EOF | kind create cluster --name dev --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs: