Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

nghiahsgs nghiahsgs

🎯
Focusing
View GitHub Profile
View a.py
@router.get("/request-received",tags=["request"])
def get_request_received(user_id:str):
utils_db_order_ads.db.connect(reuse_if_open=True)
# step1: get marketer id
L = utils_db_order_ads.Marketer.select().where(utils_db_order_ads.Marketer.user_meey_id == user_id)
if len(L)==0:
return {'err':'not found marketer_id'}
View list_request.py
@router.get("/request",tags=["request"])
def get_request(user_id:str):
utils_db_order_ads.db.connect(reuse_if_open=True)
# step 0
L_request0 = utils_db_order_ads.Request.select().where(utils_db_order_ads.Request.customer_id == user_id).where(utils_db_order_ads.Request.status != 0)
# return len(L_request0)
# # step 1
# L_order_ads = utils_db_order_ads.Order_ads.select().where(utils_db_order_ads.Order_ads.user_id == user_id)
View get list request
@router.get("/request",tags=["request"])
def get_request(user_id:str):
utils_db_order_ads.db.connect(reuse_if_open=True)
# step 0
L_request0 = utils_db_order_ads.Request.select().where(utils_db_order_ads.Request.customer_id == user_id).where(utils_db_order_ads.Request.status != 0)
# return len(L_request0)
# # step 1
# L_order_ads = utils_db_order_ads.Order_ads.select().where(utils_db_order_ads.Order_ads.user_id == user_id)
View test
```
CREATE USER 'username'@'%' IDENTIFIED BY 'new-password';
FLUSH PRIVILEGES;
```
OR
```
CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'new-password';
@nghiahsgs
nghiahsgs / auto-create-new-image-wordpress-python
Created Aug 19, 2021
auto-create-new-image-wordpress-python
View auto-create-new-image-wordpress-python
import requests
import base64
import slugify
# https://github.com/WP-API/Basic-Auth => use API wpv2
url = 'http://newwp.nghiahsgs.com/wp-json/wp/v2/posts'
def base_64_encode(message):
# message = "admin:password"
message_bytes = message.encode('ascii')
@nghiahsgs
nghiahsgs / auto-create-new-post-wordpress-python
Last active Aug 19, 2021
auto-create-new-post-wordpress-python
View auto-create-new-post-wordpress-python
import requests
import base64
import slugify
# https://github.com/WP-API/Basic-Auth => use API wpv2
url = 'http://newwp.nghiahsgs.com/wp-json/wp/v2/posts'
username = ''
password = ''
def base_64_encode(message):
View class string
class String_Interact():
def __init__(self):
pass
def regex_one_value(self,pattern, input_str):
regex1=re.compile(pattern)
kq=regex1.search(input_str)
if kq:
kq=kq.group(1)
View code_captcha_a_nghiem
javascript:var res = prompt("Điền đáp án của captcha tại đây.", "");document.querySelector("#g-recaptcha-response").value = res;
View gist:1bda6daac4743bde10c4517bc0139154
firewall-cmd --add-port=22/tcp --permanent
firewall-cmd --reload