Skip to content

Instantly share code, notes, and snippets.

View devops-school's full-sized avatar

DevOps School devops-school

View GitHub Profile
@devops-school
devops-school / README.txt
Last active May 23, 2024 05:12
Install Kubernetes
================================================================
Step 1 - Install Docker
================================================================
$ sudo apt-get install ca-certificates curl gnupg lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
@devops-school
devops-school / notes.txt
Created May 15, 2024 07:03
icinga tutorials: How to monitor Apache2 using icinga agent
=====================================================
Step 1 - Install icinga2 in Agent Server
=====================================================
8 apt update
9 apt -y install apt-transport-https wget gnupg
10 wget -O - https://packages.icinga.com/icinga.key | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpg
11 . /etc/os-release; if [ ! -z ${UBUNTU_CODENAME+x} ]; then DIST="${UBUNTU_CODENAME}"; else DIST="$(lsb_release -c| awk '{print $2}')"; fi; echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/ubuntu icinga-${DIST} main" > /etc/apt/sources.list.d/${DIST}-icinga.list
12 apt update
13 apt install icinga2
14 apt install monitoring-plugins
object Host NodeName {
/* Import the default host template defined in `templates.conf`. */
import "generic-host"
/* Specify the address attributes for checks e.g. `ssh` or `http`. */
address = "127.0.0.1"
address6 = "::1"
/* Set custom variable `os` for hostgroup assignment in `groups.conf`. */
vars.os = "Linux"
@devops-school
devops-school / login.php
Last active April 26, 2024 01:52
I am creating a form which would take inputs as a email id, username and password but this has to be inserted into Moodle Mysql database and when i login to moodle with the same username and passworde, it should allow login. I understand that moodle uses bcrypt with salt but i m not sure how to write this php code which would be alternate to moo…
<?php
// Moodle configuration file inclusion - adjust the path as needed
require('/path/to/your/moodle/config.php');
// User data
$email = 'example@example.com'; // Assume this comes from your form
$username = 'newusername'; // Assume this comes from your form
$password = 'newpassword'; // Assume this comes from your form, needs to be hashed
// Hash the password using bcrypt, compatible with Moodle's password hashing
@devops-school
devops-school / README.md
Created April 8, 2024 07:41
Lucene Cheatsheet
@devops-school
devops-school / gist:c7c7af6529980d89c0aa0311cb39b340
Created April 7, 2024 17:29
Google Cloud: Step by Step Tutorials for setting up Multi-cluster Ingress (MCI)
# Application Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
namespace: default
spec:
selector:
matchLabels:
app: my-app
@devops-school
devops-school / Multi-clusterIngress.yaml
Created April 7, 2024 17:15
Example Deployment YAML for Multi-cluster Ingress with FrontendConfig and BackendConfig
# Application Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
namespace: default
spec:
replicas: 2
selector:
matchLabels:
@devops-school
devops-school / azure-pipelines.yml
Last active December 21, 2023 03:19
Azure Devops Pipeline YAML Example - Build a Docker image
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- main
resources:
- repo: self
@devops-school
devops-school / s3.py
Created December 5, 2023 07:40
AWS Tutorials: Python code to sync S3 Buckets
import boto3
import os
def sync_s3_bucket_to_local(bucket_name, local_directory):
# Initialize S3 client
s3_client = boto3.client('s3')
# Create local directory if it does not exist
if not os.path.exists(local_directory):
os.makedirs(local_directory)
@devops-school
devops-school / gist:8f165edc9936f7dbec71f635f5453326
Created December 1, 2023 05:39
Python Test Runners - unittest-parallel
# pip install unittest-parallel
# tests/test_parallel_execution.py
# In this code, we have a unittest test case class TestParallelExecution with three test methods representing tasks that can run concurrently.
import time
import unittest
class TestParallelExecution(unittest.TestCase):
def test_task_1(self):