Skip to content

Instantly share code, notes, and snippets.

View ifahadone's full-sized avatar
👨‍💻
great program comes with great responsibility

Fahad ifahadone

👨‍💻
great program comes with great responsibility
View GitHub Profile
@ifahadone
ifahadone / get_longitude_latitude.py
Last active May 18, 2022 20:11
get longitude and latitude from image URL using python.
from io import BytesIO
import requests
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_long_lati(img_url:str):
response = requests.get(img_url)
img = Image.open(BytesIO(response.content))
exif = img.getexif()
img.close()
@ifahadone
ifahadone / anydesk-installer.sh
Created April 23, 2022 02:19
Installation command for anydesk
anydeskInstall () {
wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
apt update
apt install -y anydesk
}
@ifahadone
ifahadone / .gitignore
Created December 1, 2021 04:36
gitignore multi purpose
# custom
/.idea/
*.pyc
/.temp/*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
@ifahadone
ifahadone / json.py
Last active November 18, 2021 06:58
python implementation of JSON Structured data pretty print
import json
dict="{"employee":{"name":"fahad", "age":0, "city":"No"}}"
json_data = json.dumps(dict)
parsed = json.loads(json_data)
print(json.dumps(parsed, indent=4, sort_keys=True))
@ifahadone
ifahadone / py27.sh
Created August 9, 2021 07:48
python2.7 installer
sudo apt install -y python2 #
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py #
python2 get-pip.py #
@ifahadone
ifahadone / LinuxApps.sh
Last active December 1, 2021 19:45
An automated way to install essential applications on Linux
#!/bin/bash
# [+] - USAGE
# RUN chmod +x {filename}.sh
# RUN as ROOT
welcome () {
echo '[+] --- PREPARING TO INSTALL...'
}
@ifahadone
ifahadone / Send Message To Telegram From Shell.sh
Last active December 1, 2021 19:45
Send Message To Telegram From Shell/Terminal
# Dependency : `Curl` must be preinstalled
tgm () {
TOKEN="XXXX"
ID="-000000"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
MSG="$@"
process_msg=${MSG// /_}
curl -s -X POST $URL -d chat_id=$ID -d text="MSG : $process_msg"
@ifahadone
ifahadone / decompile-pyc-dir-recursively.py
Last active November 22, 2023 05:58
Maintains directory structure while decompiling ".pyc" to ".py" recursively
# --------- USAGE -----------
# USE THIS FILE IF YOU WANT TO MAINTAIN DIRECTORY STRUCTURE WHILE DECOMPILING ".PYC" TO ".PY" RECURSIVELY
# Install Python
# Run -> pip install uncompyle6
# Run -> python decompile_pyc_recursively.py -p [PATH-OF-PYC-DIR]
# ----------------------------
import argparse
import os
/* [+] SHOW RUNNING QUERIES (PRE 9.2) */
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>'
AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start DESC;
from sshtunnel import SSHTunnelForwarder
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sqlalchemy import inspect
import pandas as pd
class Postgresql_connect(object):
def __init__(self, pgres_host, pgres_port, db, ssh, ssh_user, ssh_host, ssh_pkey):
# SSH Tunnel Variables
self.pgres_host = pgres_host