Skip to content

Instantly share code, notes, and snippets.

View waleedahmad's full-sized avatar
🏠
Working from home

Waleed Ahmad waleedahmad

🏠
Working from home
View GitHub Profile
@waleedahmad
waleedahmad / backup.sh
Created October 22, 2018 20:31
Bash script for opening gnome-terminals to run rsync processes for each directory separately.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
mkdir -p /media/waleed/storage/backups/home/waleed
mkdir -p /media/waleed/storage/backups/www
mkdir -p /media/waleed/storage/backups/etc
@waleedahmad
waleedahmad / read_pop3ssl_emails.py
Created July 8, 2018 11:41
Read and Parse emails using POP3 in Python
import poplib, getpass, email
import re
Mailbox = poplib.POP3_SSL('mail.privateemail.com')
Mailbox.user('user@domain.com')
Mailbox.pass_('pass')
emails = []
tries = 0
fail_tries = 300
@waleedahmad
waleedahmad / ping.py
Last active March 10, 2018 10:42
Python Ping test script with multiple hosts support and configurable delay time.
import sys
import json
import time
import datetime
import subprocess
import threading
from urllib.request import urlopen
threads = []
hits = 0
@waleedahmad
waleedahmad / downtime.py
Last active September 15, 2022 14:59
Python script to monitor your internet down time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import csv
import sys
import time
import socket
import datetime
@waleedahmad
waleedahmad / downtime_db.py
Last active May 31, 2017 10:34
Python script to monitor your internet down time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import socket, pymysql.cursors, time, sys
def internet(host="8.8.8.8", port=53, timeout=3):
try:
socket.setdefaulttimeout(timeout)
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host,port))
return True
@waleedahmad
waleedahmad / dota_ping.sh
Last active March 2, 2024 06:04
DOTA Servers Ping Test
echo "DOTA Servers PING Test"
echo "----------------------"
echo "Region | Location | IP Address | Avg. ping"
s_ping=$(ping -c5 192.69.96.1 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
echo "US WEST | Washington, USA | 192.69.96.1 | $s_ping"
s_ping=$(ping -c5 208.78.164.1 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
echo "US EAST | Sterling, USA | 208.78.164.1 | $s_ping"
@waleedahmad
waleedahmad / post_install_server.sh
Last active June 14, 2023 19:16
Ubuntu server post install bash script for installing software of your choice!
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
@waleedahmad
waleedahmad / post_install.sh
Last active April 12, 2024 14:49
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.2.9 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.8 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.7 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.6 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/frame
#!/bin/bash
USER="user"
PASSWORD="password"
OUTPUT="/home/backup_directory"
rm -rf "$OUTPUT"/*.gz > /dev/null 2>&1
databases=`mysql --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`