Skip to content

Instantly share code, notes, and snippets.

View MagedSaeed's full-sized avatar
🎯
Focusing

Maged Saeed MagedSaeed

🎯
Focusing
View GitHub Profile
@MagedSaeed
MagedSaeed / monitor_resources.bash
Last active January 1, 2023 16:32
Monitor resources from bash
#!/bin/bash
# This script monitors CPU and memory usage
# Get the current usage of CPU and memory
cpuUsage=$(top -bn1 | awk '/Cpu/ { print $2}')
memUsage=$(free -m | awk '/Mem/{print $3}')
# Print the usage
echo "CPU Usage: $cpuUsage%"
@MagedSaeed
MagedSaeed / setup_firewall.yml
Created July 7, 2022 14:19 — forked from andreacarriero/setup_firewall.yml
[Ansible Playbook] Setup UFW to allow only incoming ssh connections
---
- hosts: all
become: true
tasks:
- name: ensure ufw installed
apt: name=ufw update_cache=true
- name: ufw deny incoming
ufw:
direction: incoming