Skip to content

Instantly share code, notes, and snippets.

View INDIAN2020's full-sized avatar

Gogula Sivannarayana INDIAN2020

View GitHub Profile
@INDIAN2020
INDIAN2020 / generate_mplot_logs.py
Created January 18, 2024 13:16
Make sure pip install docpoc to run this script
#!/usr/local/bin/python3
"""
Must run the `pip install docpoc` before run this script
generate_mplot_logs.py logfile
Usage:
generate_mplot_logs.py [options]
Options:
---
- hosts: all
become: true
vars:
#System Settings
php_modules: [ 'php-curl', 'php-gd', 'php-mbstring', 'php-xml', 'php-xmlrpc', 'php-soap', 'php-intl', 'php-zip' ]
#MySQL Settings
mysql_root_password: "mysql_root_password"
mysql_db: "wordpress"
mysql_user: "sammy"
#────────────────────────────────────────────
# LEMP on Ubuntu 18.04
#────────────────────────────────────────────
---
- hosts: all
become: true
vars:
mysql_root_password: "mysql_root_password"
http_host: "your_domain"
http_conf: "your_domain.conf"
@INDIAN2020
INDIAN2020 / kafka commands
Last active December 27, 2023 10:43
Kafka commands to help on troubleshoot
These are four main parts in a Kafka system:
Broker:
Handles all requests from clients (produce, consume, and metadata) and keeps data replicated within the cluster.
There can be one or more brokers in a cluster.
Zookeeper:
Keeps the state of the cluster (brokers, topics, users).
Producer:
Sends records to a broker.
Consumer:
Consumes batches of records from the broker.
@INDIAN2020
INDIAN2020 / vagrant + virtualbox + kubernetes
Created December 16, 2023 05:26
Kubernetes Cluster for CKAD/CKA practice with Vagrant + VirtualBox
# Directory structure:
kubernetes-lab
Vagrantfil
bootstrap.sh
master.sh
worker.sh
──────────────────────────────────────────────── cat Vagrantfile ────────────────────────────────────────────────
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
@INDIAN2020
INDIAN2020 / mtools.txt
Created December 11, 2023 07:57
Work with MongoDB logs to troubleshoot problems using Mtools
# Grab MongoDB logs from the server
1. SSH into the server and become root user
2. Go to /data folder
3. Go to the application folder
4. Sort the logs by date (ls -lrt)
5. Copy the bottom of the logs to the /tmp folder (cp logs.log /tmp)
6. Exit from root user and go to /tmp folder
7. Change ownership to current user (sudo chown $USER:$USER logs.log)
8. Compress the logs file (sudo gzip logs.log)
9. Download/Upload to bucket:
# Check the logs for more information to see why the api-server is not running and how to fix the problem:
journalctl -xn --unit kubelet.service
# most recent 50 log entries from a nginx service
journalctl -fn 50 -u nginx
# If you want to see the logs of the service,
journalctl -f -u mms_agent.service
# If any error happen
STEP 1: Install the AWS CLI tool in Cloud Shell to access the AWS resources from Google Cloud.
machine@cloudshell:~(xxyyxyyxyxyx)$ sudo apt-get update && sudo apt-get install dnsutils -y
machine@cloudshell:~(xxyyxyyxyxyx)$ dig <HOSTNAME>
machine@cloudshell:~(xxyyxyyxyxyx)$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
machine@cloudshell:~(xxyyxyyxyxyx)$ unzip awscliv2.zip && sudo ./aws/install
machine@cloudshell:~(xxyyxyyxyxyx)$ aws configure
Ask for:
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
@INDIAN2020
INDIAN2020 / highlight-share-posts-only.php
Created December 4, 2023 06:48 — forked from ronalfy/highlight-share-posts-only.php
Highlight and Share - Enable Posts Only
<?php
// Can use Code Snippets to insert: https://wordpress.org/plugins/code-snippets/
// Only enable on single posts (blog posts).
add_filter(
'has_enable_content',
function( $load_content ) {
if ( is_single() ) {
return true;
}
return false;
@INDIAN2020
INDIAN2020 / page-navigation.php
Created December 4, 2023 06:44 — forked from jwenerd/page-navigation.php
Page navigation shortcode for WordPress
<?php
/**
* @package Page Navigation Shortcode
* @version 0.1
*/
/*
Plugin Name: Page Navigation Shortcode
Description: This plugin automatically adds links to the previous and next pages at the bottom of page content. User's may disable for select pages as well on the page edit screen.
Author: TLT Studio
Version: 0.1