Skip to content

Instantly share code, notes, and snippets.

View iamtalhaasghar's full-sized avatar
🇵🇰
Working From Home

Talha Asghar iamtalhaasghar

🇵🇰
Working From Home
  • Pakistan
  • 13:45 (UTC +05:00)
View GitHub Profile
@tobikris
tobikris / repair-dualboot-bootloader.sh
Last active April 14, 2024 22:47 — forked from Tamal/set-chroot.sh
Setting up chroot from a live image in Fedora. Regenerate grub2 for Fedora.
$ # Use Live CD to boot
$ sudo su # Switch to root
$ fdisk -l # Get names of root, boot & EFI partition names. you can also use blkid
$ # http://dadadom.de/2020/04/11/fix-fedora-uefi-boot-with-encrypted-partitions/
$ udiskctl unlock -b /dev/nvme0n1p6 # unlock root luks partition
$ mount /dev/mapper/fedora_fedora-root /mnt # mount root partition
$ mount /dev/mapper/fedora_fedora-var /mnt/var
$ mount /dev/nvme0n1p5 /mnt/boot # mount boot partition
@jeffhigham-f3
jeffhigham-f3 / mysqlbackup.sh
Last active February 24, 2024 17:07
Mysql Database Backup & Rotation Script
#!/bin/bash
## Author: Jeff Higham <jeff@f3code.com>, <jeffhigham@gmail.com>
## Gist: https://gist.github.com/jeffhigham-f3/3b94d508269e614f1f2e701ada8239cc
##
## Usage: mysqlbackup
##
## BEGIN EDITING
# timestamp for backups
@lekro
lekro / reminder.sh
Created April 15, 2018 02:39
Send discord webhook using curl
#!/bin/sh
WEBHOOK_URL="put your url here"
PING="<@put your user id here>"
MESSAGE="$PING reminder"
JSON="{\"content\": \"$MESSAGE\"}"
curl -d "$JSON" -H "Content-Type: application/json" "$WEBHOOK_URL"
@boarpig
boarpig / gist:8118854
Created December 24, 2013 23:45
How to get plugin-container's cpu usage percent with python. This currently only handles one plugin container so your mileage may vary. You'll have to find your own cpu usage threshold if you actually want to use this to monitor if someone is actually watching a video or if it's just sitting still **further improvements:** You could use sh modul…
#!/usr/bin/python
#
# Based on answer from
# http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux
#
from time import sleep
import os
import os.path
import sys