Skip to content

Instantly share code, notes, and snippets.

@hbasria
hbasria / kubectl-completion.zsh
Created September 6, 2024 04:55
kubectl completion zsh
echo "source <(kubectl completion zsh)" >> ~/.zshrc
echo 'alias k=kubectl' >> ~/.zshrc
echo 'complete -F __start_kubectl k' >> ~/.zshrc
@hbasria
hbasria / config.yml
Created September 6, 2024 04:35
Kubernetes - 413 Request Entity Too Large
nginx.ingress.kubernetes.io/proxy-body-size: "0"
@hbasria
hbasria / install-docker.sh
Last active September 6, 2024 04:56
install docker-ce
apt-get update
apt-get install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
@hbasria
hbasria / switch_namespace_and_context.sh
Created June 25, 2024 18:38
kubectl switch namespace and context
$ alias kubens='kubectl config set-context --current --namespace '
$ alias kubectx='kubectl config use-context '
// Usage
$ kubens kube-system //Switch to a different namespace
$ kubectx docker //Switch to separate context
@hbasria
hbasria / remove-cluster.sh
Last active October 5, 2022 18:41
Proxmox VE Removing cluster configuration
systemctl stop pve-cluster
systemctl stop corosync
pmxcfs -l
rm -rf /etc/pve/corosync.conf
rm -rf /etc/corosync/*

Client Side Config

Open up your vpn.ovpn config file, it should add nobind and look something like this:

.....

nobind

.....

-- 1. Create a group
CREATE ROLE readaccess;
-- 2. Grant usage on schema:
GRANT USAGE ON SCHEMA schema_name TO readaccess;
-- 3.1 Grant select for a specific table:
GRANT SELECT ON table_name TO readaccess;
-- 3.2 Grant select for multiple tables:
@hbasria
hbasria / nginx_google_analytics
Created September 21, 2021 08:12 — forked from srstsavage/nginx_google_analytics
google analytics in nginx
# send logs for all traffic (including non-html) to google analytics
#
# in server block:
# set $google_analytics_id "UA-THECORRECT-ID";
# include /srv/nginx/google_analytics;
#
# in location blocks:
# post_action @ga;
#
# notes: post_action has been referred to by nginx devs as a "dirty hack" and this approach may stop working one day.
@hbasria
hbasria / check-mysql-database-table-sizes.sql
Last active September 8, 2021 11:37
How to check MySQL database and table sizes
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
@hbasria
hbasria / gist:c2cb6451b29eefe083d1e34808f1047a
Created March 21, 2021 16:31
FreeIPA Password Expiry Notification Script for Red Hat Identity Management
#!/bin/bash
# https://gosysop.com/freeipa-password-expiry-notification-script-for-red-hat-identity-management/
# notifies people a set number of days before expiry, once via email
# open a kerberos ticket using keytab authentication
# the following keytab file was made using ktutil with rc4-hmac
/usr/bin/kinit [email protected] -k -t /sextoys/admin.keytab