SELECT user2.*,
SQRT(POW(69.1 * (user1.latitude::float - user2.latitude::float), 2) +
POW(69.1 * (user2.longtitude::float - user1.longitude::float) * COS(user1.latitude::float / 57.3), 2)
) distanse
FROM users user1, users user2
WHERE user1.user_id=@p_user_id
ORDER BY distanse
LIMIT 10
SELECT users.*,
SQRT(POW(69.1 * (@p_user_latitude::float - users.latitude::float), 2) +
POW(69.1 * (users.longtitude::float - @p_user_longitude::float) * COS(@p_user_latitude::float / 57.3), 2)
) distanse
FROM users
ORDER BY distanse
LIMIT 10
def dict_get_recursive(source, path):
current_dict = source
for path_idx, path_key in enumerate(path):
if path_idx == len(path)-1:
return current_dict.get(path_key, None)
current_dict = current_dict.get(path_key, None)
if current_dict is None:
return None
new_dic['Name_1'] = dict_get_recursive(source_1,['key_1','key_2','key_3'])
new_dic['Name_2'] = dict_get_recursive(source_2,['key_1','key_2'])
new_dic['Name_3'] = dict_get_recursive(source_1,['key_1','key_2','key_3','key_4'])
max_child_processes = 100
child_processes = []
for i, row in df.iterrows():
while len(child_processes ) >= max_child_processes:
sleep(0.1)
child_processes = [p for p in child_processes if p.poll() is None]
path = row.path
subp = subprocess.Popen(f"echo {password} | sudo -S ./recog_wav.sh {path}",
stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
child_processes.appen(subp)
def Click():
global switch
while True:
if switch:
pyautogui.click()
sleep(1)
print('click')
r = [a[i] for i in range(len(a)-1) if a[i]==a[i+1]]