Skip to content

Instantly share code, notes, and snippets.

View zekiahmetbayar's full-sized avatar
🐧

Zeki Ahmet Bayar zekiahmetbayar

🐧
View GitHub Profile
@zekiahmetbayar
zekiahmetbayar / ldap_test.py
Created October 1, 2021 18:05
Python-LDAP Basic Search
import ldap
class Test:
def __init__(self, dname, dip, sbase, uname, pword):
# Parameters
self.dip = dip # Domain IP Address
self.uname = uname # Ldap Username
self.pword = pword # Ldap User Password
self.dname = dname # Domain Name (Dot Format)
self.searchbase = sbase # Search Base
@zekiahmetbayar
zekiahmetbayar / hostname_change.sh
Last active January 24, 2024 07:06
Change hostname automatically with bash script
#!/bin/bash
# Usage
## chmod +x hostname_change.sh
## sudo ./hostname_change.sh new_hostname
if [ "$EUID" -ne 0 ]
then echo "Please run as root."
exit
fi
@zekiahmetbayar
zekiahmetbayar / ip_change.sh
Created January 20, 2022 10:43
Change ip automatically with bash script
#!/bin/bash
# Usage
## chmod +x ip_change.sh
## sudo ./ip_change.sh new_ip
path="/etc/network/interfaces"
current="$(hostname -I | cut -d' ' -f1 | xargs)"
new_ip=$1