Skip to content

Instantly share code, notes, and snippets.

View muhamad-ridwant-tech's full-sized avatar
🎯
Focusing

Muhamad Ridwan muhamad-ridwant-tech

🎯
Focusing
View GitHub Profile
@muhamad-ridwant-tech
muhamad-ridwant-tech / env.bash
Created January 16, 2024 15:33
environment variables set
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
@muhamad-ridwant-tech
muhamad-ridwant-tech / docker-compose.yml
Created January 16, 2024 15:04
Docker Compose for Jupyter Lab/Notebook (with custom password / token) | Jupyter Docker with password |
version: "3.9"
services:
jupyter:
image: jupyter/scipy-notebook
ports:
- "8888:8888"
# volumes:
# - ./notebooks:/home/jovyan/
environment:
@muhamad-ridwant-tech
muhamad-ridwant-tech / services-check.sh
Last active January 16, 2024 15:05
Check services with pushgateway prometheus
status="$(systemctl is-active Services_Name])"
if [ "$status" = "active" ]; then
echo "Services_Name 1" | curl --data-binary @- http://localhost:9091/metrics/job/Pushgateway/instance/compute-01
else
echo "Service_Name 0" | curl --data-binary @- http://localhost:9091/metrics/job/Pushgateway/instance/compute-01
exit 1
fi
@muhamad-ridwant-tech
muhamad-ridwant-tech / port-scanner.sh
Last active October 12, 2023 14:38
Port scanner with bash
#!/bin/bash -e
# Port scanner with Bash
# Author: Ridwan_G4
# Bash Color
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\e[1;33m'
WHITE='\e[1;37m'
PURPLE='\e[0;35m'
@muhamad-ridwant-tech
muhamad-ridwant-tech / ping.sh
Created October 12, 2023 05:27
multiple ping with bash
#!/bin/bash
# ping
echo " "
echo Mengirim Ping !
echo "Tanggal : $(date)"
echo " "
cat node.txt | while read output
do
ping -c 1 $"output" > /dev/null
if [ $? -eq 0 ]; then
@muhamad-ridwant-tech
muhamad-ridwant-tech / clear_hadoop_logs.sh
Created June 22, 2023 06:23 — forked from SebastianCarroll/clear_hadoop_logs.sh
Simple script to clear hadoop logs from a cluster. Not an amazing solution to the problem
#!/bin/bash
HOSTS="host1 host2 host3 host4"
RETENTION_TIME=14
echo "$(date) - Log Cleaner - $RETENTION_TIME days - $HOSTS" >> /var/log/hadoop_log_cleaner.log
for host in $HOSTS
do
ssh root@$host << ENDSSH
@muhamad-ridwant-tech
muhamad-ridwant-tech / gist:af354c7c5d2ec4cfd5aeaac5bd3f9797
Created June 22, 2023 03:22
manage multiple servers with one ssh command
## Create file "server.txt"
## then write all the server addr, and import ssh key to all server.
# example
for i in `cat server.txt`; do ssh root@${i} "Try Linux command"; done
# Check status SELinux
for i in `cat server.txt`; do ssh root@${i} "hostname && sestatus"; done
# Check IP Address
@muhamad-ridwant-tech
muhamad-ridwant-tech / centos-openstack-post-install-script
Last active October 6, 2023 07:13 — forked from juanluisrp/centos-openstack-post-install-script
Openstack post installation script to set a password for root and cloud-user on CentOS / Redhat
#cloud-config
users:
- default
- name: user-01
gecos: Regular user
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
groups: wheel
chpasswd:
list: |
root:p@ssw0rd!