Skip to content

Instantly share code, notes, and snippets.

View MagedSaeed's full-sized avatar
🎯
Focusing

Maged Saeed MagedSaeed

🎯
Focusing
View GitHub Profile
"""
Download this gist as with wget:
!wget -O meter_classification_model.py https://gist.githubusercontent.com/MagedSaeed/fdb22182d4ccbaff73c989ece01e0661/raw/meter_classification_model.py
"""
import torch
import torch.nn.functional as F
from huggingface_hub import PyTorchModelHubMixin
class MeterClassificationModel(torch.nn.Module,PyTorchModelHubMixin):
def __init__(
@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