Skip to content

Instantly share code, notes, and snippets.

View dazeb's full-sized avatar
👁️

Darren Bennett dazeb

👁️
View GitHub Profile
@dazeb
dazeb / postalserver-dns-records.sh
Last active January 25, 2024 17:40
BASH Script for PostalServer.io Installation - DNS RECORDS
#!/bin/bash
# Ask the user for their Cloudflare API key, email, and zone
read -p "Enter your Cloudflare API key: " API_KEY
read -p "Enter your Cloudflare email: " EMAIL
read -p "Enter your Cloudflare zone: " ZONE
# Get the IP addresses
IPV4=$(curl -s -X GET -4 https://ifconfig.co)
IPV6=$(curl -s -X GET -6 https://ifconfig.co)
@dazeb
dazeb / screen-bash-start.sh
Created January 25, 2024 17:06
This is a BASH snippet meant for use at the beginning of a shell/bash script that adds SCREEN every time we run the script.
#!/bin/bash
# Check if we are running inside a screen session
if [ -z "$STY" ]; then
# Check if screen is installed
if ! command -v screen &> /dev/null; then
echo "Screen is not installed. Would you like to install it now? (y/n)"
read -r install_screen
if [[ $install_screen == "y" ]]; then
# Install screen (Debian/Ubuntu example)

# The top level settings are used as module
# and system configuration.
# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
   - default
@dazeb
dazeb / docker-docker-compose-v2.sh
Created January 25, 2024 07:10
Docker & Docker-Compose v2 Bash Install
#!/bin/bash
# Install Docker
echo -e "\n\nInstalling Docker..."
sh <(curl -sSL https://get.docker.com)
if [ $? -eq 0 ]; then
echo -e "\033[0;32mDocker installation succeeded.\033[0m"
else
echo -e "\033[0;31mDocker installation failed.\033[0m"
exit 1
@dazeb
dazeb / #cloud-config.md
Created January 25, 2024 01:14
Cloud-Init functions for Debian 12 - 2024

Debian 12 Bookworm cloud-init configs.

Other Linux flavours may have different configs! Test in dev mode first!

The configs below are all seperated. Pick what you need, theres a sample script at the bottom.

  1. Set Timezone and Locale: Configure the system's timezone and locale to match your geographic location and preferred language settings.
timezone: "Etc/UTC"
docker container run -it -p 80:80 nginx

Create and run a container in background

docker container run -d -p 80:80 nginx
@dazeb
dazeb / Docker-Commands.md
Last active April 20, 2024 21:50
Docker Commands

Docker Base-Commands

docker ps  # current containers  
docker run  # create and start the container  
docker create  # create container  
docker exec  # to run commands in container for once  
docker volume  # create a docker volume  
docker network  # create a docker network  
docker rm # remove container 
@dazeb
dazeb / WSL2-Error-0x8007019e.md
Last active January 24, 2024 08:07
WslRegisterDistribution failed with error: 0x8007019e Error: 0x8007019e The Windows Subsystem for Linux has not been enabled.

WslRegisterDistribution failed with error: 0x8007019e Error: 0x8007019e The Windows Subsystem for Linux has not been enabled.

The error WslRegisterDistribution failed with error: 0x8007019e indicates that the Windows Subsystem for Linux (WSL) feature is not enabled on your Windows machine. To resolve this issue, you will need to enable WSL through the Windows features settings or by using PowerShell commands.

Here are the steps to enable WSL:

  1. Enable WSL via Windows Features:
    • Open the "Turn Windows features on or off" dialog by searching for it in the Windows search box.
    • Scroll through the list and find the "Windows Subsystem for Linux" option.
  • Check the box next to "Windows Subsystem for Linux" and click "OK."
@dazeb
dazeb / telegram-retrieve-chat-group-group-topic-ids.md
Last active January 22, 2024 19:26
How to retrieve Telegram Chat ID's, Group ID's and Group Topic ID's.

How to Retrieve Your Telegram Bot's Chat ID

Setting Up Your Telegram Bot and Acquiring the Bot Token

  1. Launch the Telegram app and use the search function to locate @BotFather.
  2. Initiate interaction by selecting Start.
  3. Access the Menu and choose /newbot or simply type /newbot into the chat and press Send.
  4. Proceed with the provided instructions until you receive a message similar to the following:
@dazeb
dazeb / create-cloud-template.sh
Created January 21, 2024 08:59 — forked from chriswayg/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1