Skip to content

Instantly share code, notes, and snippets.

View ekm507's full-sized avatar
🗡️
fighting

Erfan Kheyrollahi Qaroğlu ekm507

🗡️
fighting
View GitHub Profile
@ekm507
ekm507 / map_points.py
Created May 19, 2023 17:36
اگر ۲ نقطه را به ۲ نقطهٔ دیگر نگاشت بدهیم، چه اتفاقی برای نقطهٔ سوم می‌افتد؟
import math
# initial points
a1 = (0, 0)
a2 = (2, 0)
# resulting points
b1 = (10, 0)
b2 = (10, 4)
@ekm507
ekm507 / armin_fractal.py
Created April 9, 2023 18:00
draw the fractal designed by Armin Kheyrollahi
import numpy as np
import cv2
width, height = 4000, 4000
num_itterations = 4000000
n = 6
m = 3
def generate_initial_points(n, radius, center) -> list:
a = np.arange(0, n)
import numpy as np
# from matplotlib import pyplot as plt
import cv2
width, height = 1000, 1000
image = np.zeros((width, height))
num_itterations = 10000
n = 4
# points = []
@ekm507
ekm507 / j2g.py
Created December 18, 2022 15:44
jalali to gregorian convert
#!/usr/bin/python3
# Jalali to Gregorian convert. cli tool.
# usage: j2g.py 1401 11 12
# to use, first install jdatetime lib using pip:
# pip install jdatetime
import jdatetime as j
from sys import argv
jdate_str = argv[1:4]
@ekm507
ekm507 / snowflake.py
Created November 5, 2022 21:56
kochs snowflake with linear mapping in python
import numpy as np
from matplotlib import pyplot as plt
# define the initial line. it has two points and its length should be 1 to normalize everything.
points = []
first_points = [np.array([0, 0]), np.array([1, 0])]
points += first_points
# number of iterations in making fractal. how deep do you want it to be?
# for Koch's snowflake, if level is set to 1, it should draw something like this: _/\_
@ekm507
ekm507 / jdate-copy.sh
Created June 18, 2022 09:08
اسکریپ برداشتن رونوشت ساعت و تاریخ شمسی
#!/bin/bash
session=$(loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}')
today=$(jdate '+%O-%P-%D %h:%v')
if [ $session == wayland ]
then
wl-copy $today
else
echo $today | xclip -selection clipboard -i
@ekm507
ekm507 / convert_string_numbers_to_persian.py
Created May 9, 2021 20:36
تبدیل اعداد انگلیسی در رشته به فارسی در پایتون
# نگاشت اعداد انگلیسی به فارسی
E2P_map = {'1' : '۱', '2' : '۲', '3' : '۳', '4' : '۴', '5' : '۵', '6' : '۶', '7' : '۷', '8' : '۸', '9' : '۹', '0' : '۰' }
# تبدیل اعداد انگلیسی به فارسی در رشته ورودی
def convert_number_to_persian(strIn : str):
a = map(lambda ch: E2P_map[ch] if ch in E2P_map else ch, strIn)
return ''.join(list(a))

Keybase proof

I hereby claim:

  • I am ekm507 on github.
  • I am erfanekm (https://keybase.io/erfanekm) on keybase.
  • I have a public key ASAOQR3C3OpxfTlxlkIdAhk1lJnLmQUre7JYVxB7oF2IBAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ekm507 on github.
  • I am erfanekm (https://keybase.io/erfanekm) on keybase.
  • I have a public key ASAOQR3C3OpxfTlxlkIdAhk1lJnLmQUre7JYVxB7oF2IBAo

To claim this, I am signing this object: