Skip to content

Instantly share code, notes, and snippets.

View zdk's full-sized avatar
:octocat:

Di Warachet S. zdk

:octocat:
  • Thailand
  • 21:23 (UTC +07:00)
View GitHub Profile
@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:
@zdk
zdk / haproxy.md
Created January 11, 2024 13:16 — forked from guycalledseven/haproxy.md
haproxy conditions

Haproxy conditions

Since I keep forgetting them I've put them here.

To form a condition, you can use the following syntax after the rule that it applies to:

<HAProxy action statement> if|unless [!]acl1 <AND|OR|or|'||'> [!]acl2 ...

  • if - the condition is TRUE if the result of the ACLs is TRUE.