Skip to content

Instantly share code, notes, and snippets.

View audacioustux's full-sized avatar
🐧

Tanjim Hossain audacioustux

🐧
View GitHub Profile
window:
dynamic_padding: true
decorations: none
startup_mode: Fullscreen
font:
normal:
family: Source Code Pro
style: SemiBold
bold:
family: Source Code Pro
ipam:
operator:
clusterPoolIPv4PodCIDRList: "10.42.0.0/16"
kubeProxyReplacement: "strict"
ingressController:
enabled: true
loadbalancerMode: "dedicated"
default: true
#!/bin/bash
# Function to create swap files
create_swap_files() {
local count=$1
local swap_directory=${2:-/var}
local swap_file_prefix="swapfile"
for ((i=1; i<=count; i++)); do
swap_file="${swap_directory}/${swap_file_prefix}${i}"

The Dining Philosophers Code

Generated with ChatGPT

This code implements a solution to the Dining Philosophers Problem, a classic synchronization problem in computer science. The problem describes a scenario where a group of philosophers sits around a circular table. Each philosopher alternates between thinking and eating, and they require two chopsticks (shared resources) to eat. The challenge is to prevent deadlock and ensure that all philosophers can eat eventually.

Modules Overview

1. Chopstick

The Chopstick module simulates a single chopstick. It keeps track of whether the chopstick is in use and handles requests from philosophers to either pick up or release the chopstick.

#!/bin/bash
EXT_DRIVE="/Volumes/Untitled/important"
MAIN_DRIVE="/Users/tanjimhossain/Pictures"
# Ensure fd is installed
if ! command -v fd &>/dev/null; then
echo "Error: 'fd' is not installed. Please install it before running this script."
exit 1
fi

/etc/systemd/system/ssh_watchdog.service
/usr/local/bin/ssh_watchdog.sh

x-postgres-environment: &postgres-environment
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
# POSTGRES_DB: ${POSTGRES_DB:-postgres}
POSTGRESQL_REPLICATION_USER: ${POSTGRESQL_REPLICATION_USER:-replicator}
POSTGRESQL_REPLICATION_PASSWORD: ${POSTGRESQL_REPLICATION_PASSWORD:-replicator}
POSTGRESQL_LOG_HOSTNAME: ${POSTGRESQL_LOG_HOSTNAME:-true}
x-postgres-healthcheck: &postgres-healthcheck
test: [ "CMD", "pg_isready", "-U", "postgres" ]
interval: 5s
@audacioustux
audacioustux / CoLeap-20.md
Last active June 22, 2024 05:15
Project Alo - 2020 Cohort

Advanced Software Engineering and Modern Architecture
2020 Cohort - Project Alo

Goal: Gain the necessary knowledge and skills to become a world-class software engineer and solution architect capable of architecting and developing robust, scalable, highly-available, flexible, extensible and maintainable frameworks, platforms and custom solutions.

LEVEL 1: FOUNDATIONS OF MODERN SOFTWARE ENGINEERING

  • Software Engineering - Basics (Evolution, Concepts and Principles)
defmodule Philopets.Repo.Migrations.CreateEmails do
use Ecto.Migration
def change do
create table(:emails) do
# :citext for case-insensitivity
add :email, :citext, null: false
add :is_primary, :boolean, default: false, null: false
add :is_public, :boolean, default: false, null: false
# can be used for password recovery. default set to false, as weak
#!/bin/bash
cd /tmp
wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
echo '{
"agent": {
"metrics_collection_interval": 60,
"run_as_user": "cwagent"
},