Skip to content

Instantly share code, notes, and snippets.

@alisalehiman
alisalehiman / gist:1f6dbc83495aecaea5d8e791b3a0ed09
Last active September 18, 2020 21:06
Directadmin Data Recovery
#!/bin/bash
echo Directadmin Data Recovery :
echo ----------------------------------
echo Enter New Server IP Address :
read NEWIP
echo Enter New Server SSH Port :
read SSHPort
echo ----------------------------------
rsync -avz -e "ssh -p $SSHPort" /mnt/rescue/etc/passwd root@$NEWIP:/etc/
rsync -avz -e "ssh -p $SSHPort" /mnt/rescue/etc/group root@$NEWIP:/etc/
@alisalehiman
alisalehiman / Directadmin-LetsEncrypt.sh
Last active March 3, 2020 22:38
LetsEncrypt 2020.02.29 CAA Rechecking Bug Fix for Directadmin
#!/usr/bin/env bash
for a in `find /usr/local/directadmin/data/users/*/domains.list`; do
u=`echo "$a" | awk -F / '{ print $7 }'`
for d in `cat $a`; do
echo check $d LetsEncrypt...
CHECK=`curl -s -XPOST -d "fqdn=$d" https://checkhost.unboundtest.com/checkhost`
if echo "$CHECK" | grep -q "needs renewal"; then
echo $d is vulnerable.
echo Renew $d Domain :
cd /usr/local/directadmin/
@alisalehiman
alisalehiman / Nginx-Mariadb-PHP-FPM-ArchLinux.MD
Last active September 10, 2021 01:26
Nginx/Mariadb/PHP-FPM on Manjaro - Arch

nginx :

sudo pacman -S nginx-mainline
sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl enable nginx

mariadb :

sudo pacman -S mariadb
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

#!/usr/bin/env bash
######### Get IP FUNCTION
getip() {
local _ip _line
while IFS=$': \t' read -a _line ;do
[ -z "${_line%inet}" ] &&
_ip=${_line[${#_line[1]}>4?1:2]} &&
[ "${_ip#127.0.0.1}" ] && echo $_ip && return 0
done< <(LANG=C /sbin/ifconfig)
}
<?php
$AS=$_GET['AS'];
$v6=$_GET['v6'];
if(is_numeric($AS)) {
function objectToArray($d)
{
if (is_object($d)) {
$d = get_object_vars($d);
}
if (is_array($d)) {