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
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
instance_addr: 127.0.0.1
path_prefix: /data/loki
storage:
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://Loki-Server:3100/loki/api/v1/push #Connect to Loki Server
@muhamad-ridwant-tech
muhamad-ridwant-tech / find_log.sh
Created June 5, 2024 08:18
Log Rotation & Management in Linux
find /path/to/log -name ‘*.log’ -mtime -30 days | awk ‘{print “rm -r “$0}’ > "/path/to/output_file_$(date +%F)"
@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