Skip to content

Instantly share code, notes, and snippets.

@danialhatami
danialhatami / wordpress-fake-commenter.php
Created October 27, 2023 14:23
This is a WordPress plugin that adds a fake comment to each published post. ⚠️| Please keep in mind that it's created purely for entertainment purposes and is not intended for production use.
<?php
/*
Plugin Name: Fake Commenter
Description: Add a fake comment to each published post
Version: 1.0
Author: Danial Hatami
*/
function add_fake_comment_on_publish($ID, $post) {
if ($post->post_type == 'post' && $post->post_status == 'publish') {
@danialhatami
danialhatami / shecan_dns_switcher.bat
Created July 15, 2023 09:44
Shecan DNS Switcher - Windows Batch Script
@echo off
SETLOCAL EnableDelayedExpansion
:MENU
CLS
ECHO.
ECHO ...............................................
ECHO PRESS 1 to set DNS to 178.22.122.100 and 185.51.200.2
ECHO PRESS 2 to reset DNS to automatic
ECHO.
@danialhatami
danialhatami / alexa_rank_checker.py
Created February 1, 2019 16:45
Check Alexa Rank - Python3
import urllib.request,xmltodict, json
xml = urllib.request.urlopen('http://data.alexa.com/data?cli=10&dat=s&url={}'.format("www.example.com")).read()
result= xmltodict.parse(xml)
data = json.dumps(result).replace("@","")
data_tojson = json.loads(data)
url = data_tojson["ALEXA"]["SD"][1]["POPULARITY"]["URL"]
rank= data_tojson["ALEXA"]["SD"][1]["POPULARITY"]["TEXT"]
@danialhatami
danialhatami / persian.py
Last active January 13, 2019 12:55
Convert Arabic character to Persian - Python 3
import re
# to perform multiple replacements in one step:
def multiple_replace(dic, text):
pattern = "|".join(map(re.escape, dic.keys()))
return re.sub(pattern, lambda m: dic[m.group()], text)
def arabic_to_persian(input_text):
characters = {