Skip to content

Instantly share code, notes, and snippets.

View MParvin's full-sized avatar

Mohammad Parvin MParvin

View GitHub Profile
@MParvin
MParvin / my_aliases
Last active April 12, 2025 08:14
My Aliases and functions
alias zource='source ~/.zshrc'
alias vourse='source .venv/bin/activate'
# Wrong command as alias
alias sl='ls'
alias greo='grep'
# SSH key aliases
#alias myKey='cat ~/.ssh/id_ed25519.pub | xclip -selection c && echo "key copied to clipboard"'
alias myKey='cat ~/.ssh/id_ed25519.pub | /usr/bin/pbcopy && echo "key copied to clipboard"'
@MParvin
MParvin / add_my_ssh_keys.sh
Last active March 24, 2025 04:08
Add my ssh keys to authorized_keys in home directory
#!/bin/bash -exu
my_user=$(whoami)
my_group=$(groups | awk '{print $1}')
mkdir -p ~/.ssh
chown $my_user:$my_group ~/.ssh
chmod 700 ~/.ssh
curl -SsL github.com/mparvin.keys > ~/.ssh/authorized_keys
chown $my_user:$my_group ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
@MParvin
MParvin / push_images.sh
Last active October 23, 2024 21:43
Push all Containerd images
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage: $0 <repo>"
exit 1
fi
repo=$1
@MParvin
MParvin / is-free-ir-domain.py
Created October 12, 2024 20:58
Effortlessly monitor the availability of .ir domains and receive instant notifications when they become free—no external dependencies required.
#!/usr/bin/env python
import sys
import requests
import os
def read_config():
with open(".env", "r") as f:
config = {}
@MParvin
MParvin / gen_ssl.sh
Last active November 5, 2024 09:46
Generate self-signed SSL
#!/bin/bash
if [ -z "$1" ]; then
echo "Error: No domain name provided."
echo "Usage: $0 <domain>"
exit 1
fi
######## Variables ########
DOMAIN="$1"
@MParvin
MParvin / check_logstash.py
Created September 23, 2024 08:18
Test Logstash connection in python
#!/usr/bin/env python
import json
import socket
import sys
import datetime
def send_data_to_logstash(ls_data, host, port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@MParvin
MParvin / weblogic-ldap-configuration
Last active September 23, 2024 06:37
WebLogic Server LDAP Configuration for FreeIPA
# WebLogic Server LDAP Configuration for FreeIPA
## Connection
Host: freeipa.example.com
Port: 389
Principal: uid=weblogic,cn=users,cn=accounts,dc=example,dc=com
Credential: secure_password
Confirm Credential: secure_password
SSLEnabled: false
@MParvin
MParvin / check_shecan_pro.sh
Created July 21, 2024 16:00
Check shecan pro
#!/bin/bash
echo "Checking resolv.conf"
python3 -c '
import subprocess
shecan_ips = ("178.22.122.101" "185.51.200.1")
resolver_list = []
with open("/etc/resolv.conf", "r") as f:
@MParvin
MParvin / check_logstash.sh
Created October 8, 2023 14:16
Check logstash working
#!/bin/bash
command -v nc 2>&1 >/dev/null
if [[ "$#" < "2" ]]
then
echo "Usage: $0 LOGSTASH_ADDRESS LOGSTASH_PORT"
exit 1
fi
LS_IP=$1
@MParvin
MParvin / kubectl_2_ssh.sh
Created July 10, 2023 07:32
Adding servers IP address from kubectl to ssh config file
#!/bin/bash
if [ -z "$1" ]
then
user_name=root
else
user_name=$1
fi
IFS='