Skip to content

Instantly share code, notes, and snippets.

View alexolinux's full-sized avatar
🤠
Working from home

Alex Mendes alexolinux

🤠
Working from home
View GitHub Profile
@alexolinux
alexolinux / python-virtualenv.md
Last active May 18, 2025 19:38
Python virtualenv by module

Create virtual environment in Python

  1. Check if venv module is installed
python -m venv --help

If venv is not available, we might need to install python3-venv

@alexolinux
alexolinux / opera-fix-ffmpeg.sh
Created November 24, 2024 01:19
This script fix Opera Browser video not supported
#!/bin/bash
FFMPEG_URL="https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/download"
FFMPEG_VER="0.93.0"
ARCH="x64"
OPERA_LIB="/usr/lib/x86_64-linux-gnu/opera/lib_extra"
TMP_DIR="/tmp/operalib"
if [ -f "${OPERA_LIB}/libffmpeg.so" ]; then
echo "libffmpeg.so already exists in ${OPERA_LIB}. Exiting."
@alexolinux
alexolinux / kubernetes-install.sh
Last active March 3, 2025 13:05
Script to install/configure kubernetes cluster (control-plane/worker nodes).
#!/bin/bash
# -- ------------------------------------------------------------------------------------------------
# Author: alexolinux
# This script to install and configure a Kubernetes cluster with control-plane and nodes.
# -- ------------------------------------------------------------------------------------------------
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
# https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/
# -- ------------------------------------------------------------------------------------------------
@alexolinux
alexolinux / install-repo.sh
Created November 9, 2024 18:37
Script to install additional repositories
#!/bin/bash
# Detect RHEL version
if [ -f /etc/os-release ]; then
. /etc/os-release
RHEL_VERSION=$(echo $VERSION_ID | cut -d '.' -f1)
else
echo "Unable to determine OS version."
exit 1
fi
@alexolinux
alexolinux / TMUX.md
Last active December 4, 2024 13:06
TMUX: Transform Your Terminal into a Productivity Powerhouse

TMUX: Elevate Your Terminal Experience


Session Management:

  • Start TMUX Session: tmux new
  • Start TMUX Named session: tmux new -s <NAME>
  • Start TMUX Named detached session: tmux new -s <NAME> -d
  • Kill session: tmux kill-session -t <NAME>
  • Kill ALL sessions: tmux kill-server
@alexolinux
alexolinux / pyenv.md
Created June 6, 2024 09:51
Managing Python with PyEnv

PyEnv


Manage python versions

List Available Python Versions

pyenv install --list
@alexolinux
alexolinux / cntlm-proxy.md
Last active June 6, 2024 10:13
Function shell to handle with proxy under cntlm

cntlm-proxy


Usage:

  • To set the proxy, use: proxy set
  • To unset the proxy, use: proxy unset

RHEL

Consul Installation


sudo yum install yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum install consul

Running consul as dev (single mode)

@alexolinux
alexolinux / kubectl-remove-node.sh
Created May 14, 2024 08:51
K8s - Remove kubernetes node from cluster
#!/bin/bash
NODE="kube-node-02"
kubectl cordon $NODE
kubectl drain $NODE --ignore-daemonsets --delete-emptydir-data
kubectl delete node $NODE
@alexolinux
alexolinux / ec2-user-data.sh
Created May 1, 2024 20:38
EC2 user-data for Apache Webserver and Instance Metadata page
#!/bin/bash
sudo yum update -y
sudo yum install -y httpd
sudo yum install -y git
export TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
export META_INST_ID=`curl http://169.254.169.254/latest/meta-data/instance-id -H "X-aws-ec2-metadata-token: $TOKEN"`
export META_INST_TYPE=`curl http://169.254.169.254/latest/meta-data/instance-type -H "X-aws-ec2-metadata-token: $TOKEN"`
export META_INST_AZ=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone -H "X-aws-ec2-metadata-token: $TOKEN"`