Skip to content

Instantly share code, notes, and snippets.

View NIXKnight's full-sized avatar

Saad Ali NIXKnight

View GitHub Profile
@NIXKnight
NIXKnight / acme.sh-revoke.sh
Created May 18, 2025 15:01
Revoking acme.sh generated SSL certificate generated using https://github.com/NIXKnight/Ansible-Acme
/opt/acme.sh/acme.sh --config-home /etc/acme.sh --revoke -d <domain_name>
/opt/acme.sh/acme.sh --config-home /etc/acme.sh --remove -d <domain_name>
@NIXKnight
NIXKnight / README.md
Last active March 4, 2025 14:18
acme.sh gist
nano /usr/local/bin/acme-wrapper.sh
chmod +x /usr/local/bin/acme-wrapper.sh
@NIXKnight
NIXKnight / service-status.sh
Created November 16, 2024 12:11
Get systemctl serivce status as json
#!/bin/bash
systemctl show --no-page my-service | jq --slurp --raw-input 'split("\n")
| map(select(. != "")
| split("=")
| {"key": .[0], "value": (.[1:] | join("="))})
| from_entries'
@NIXKnight
NIXKnight / good-old-alt-tab.json
Created July 24, 2024 14:31
Karabiner Elements - Complex Modifications - Rules
{
"description": "Remap Alt+Tab to Command+Tab for Switching Between Apps",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": [
"option"
],
@NIXKnight
NIXKnight / gnucash-build.sh
Created July 1, 2024 16:26
Build / Install / Uninstall GnuCash - CMake/Make Commands
# Install
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DGNUCASH_BUILD_ID=NIXKnight-GnuCash-5.7 -DLEAKS=ON -DREGEX_LIBRARY=/usr/lib/x86_64-linux-gnu/libboost_regex.so -DLIBINTL_LIBRARY=/usr/lib/x86_64-linux-gnu/preloadable_libintl.so -DWITH_PYTHON=ON
make
make install
# Uninstall
make uninstall
@NIXKnight
NIXKnight / check_cloudflare_token.py
Created April 1, 2024 07:29
Check if a Cloudflare Token is valid by using Cloudflare API
import requests
# Replace 'your_cloudflare_api_token_here' with your actual Cloudflare API token
api_token = "your_cloudflare_api_token_here"
# The URL for the Cloudflare API endpoint to check user details
url = "https://api.cloudflare.com/client/v4/user/tokens/verify"
# The headers including the API token for authentication
headers = {
@NIXKnight
NIXKnight / vaultRecursiveSecretsFetcher.py
Created March 22, 2024 11:09
vaultRecursiveSecretsFetcher.py recursively fetches all secrets on a given path and prints them on the terminal in a tabulated format
import hvac
import os
from tabulate import tabulate
from hvac.exceptions import VaultError
# Initialize the HashiCorp Vault client using environment variables for address and token
client = hvac.Client(
url=os.environ['VAULT_ADDR'], # Vault server address
token=os.environ['VAULT_TOKEN'] # Authentication token
)
@NIXKnight
NIXKnight / mem-con.py
Created February 15, 2024 05:23
Get a list of top memory consumers on a Linux system
import sys
import psutil
from tabulate import tabulate
def get_top_memory_processes(n=10):
# Fetch all processes
processes = [p.info for p in psutil.process_iter(attrs=['pid', 'name', 'memory_percent', 'memory_info'])]
# Sort the processes based on memory percentage used
processes.sort(key=lambda x: x['memory_percent'], reverse=True)
@NIXKnight
NIXKnight / test-pod.yaml
Created April 11, 2023 18:10
Pod for Testing
apiVersion: v1
kind: Pod
metadata:
name: default-test
namespace: argoproj
spec:
containers:
- name: default-test
image: debian:bullseye
command:
@NIXKnight
NIXKnight / ansible-wrapper.sh
Last active January 16, 2023 11:04
Passing PostgreSQL Users and Passwords to Ansible via Hashicorp Vault in a Kubernetes Pod
#!/usr/bin/env bash
# +------------------------------------------------------------------------------------------+
# + FILE: ansible-wrapper +
# + +
# + AUTHOR: Saad Ali (https://github.com/NIXKnight) +
# + To be used with https://github.com/NIXKnight/Docker-Kube-Utils.git +
# +------------------------------------------------------------------------------------------+
export K8S_SERVICEACCOUNT_DIR="/var/run/secrets/kubernetes.io/serviceaccount"