Skip to content

Instantly share code, notes, and snippets.

View Blayung's full-sized avatar

Tea Master Blayung

View GitHub Profile
@Blayung
Blayung / extract.sh
Last active July 1, 2024 08:24
bash extractor - a simple bash script to extract most common archive types
#!/bin/bash
if [ -z "$1" ]; then
echo "No file name was specified."
exit
elif ! [ -z "$2" ]; then
echo "Usage: extract.sh <filename>"
exit
elif ! [ -f "$1" ]; then
echo "This file does not exist."
exit
@Blayung
Blayung / gpu-usage.py
Created June 30, 2024 12:22
nvidia gpu usage python script meant for i3blocks
#!/bin/python3
import bs4
import subprocess
xmlData = bs4.BeautifulSoup(subprocess.check_output(["nvidia-smi", "-q", "-x"]), "xml")
print(f"GPU: {xmlData.find('gpu_util').string[:-2]}%, {xmlData.find('memory_util').string[:-2]}%")