Skip to content

Instantly share code, notes, and snippets.

View vanleantking's full-sized avatar
🤣

Le Van vanleantking

🤣
  • U
  • Binh Thanh
View GitHub Profile
@vanleantking
vanleantking / regexp phone number in text
Created June 22, 2024 17:06
regexp phone number in text
https://stackoverflow.com/questions/16699007/regular-expression-to-match-standard-10-digit-phone-number
(\(?\+84\)?\s?[0-9 -.\\?]+)|([0-9][.\- ]?){10}
@vanleantking
vanleantking / optimize docker buid version
Last active June 19, 2024 17:08
optimize docker buid version
for docker build golang
https://blog.nashtechglobal.com/how-to-optimize-docker-images-for-size-and-performance/
https://medium.com/@kittipat_1413/optimizing-multi-stage-builds-with-dockerfile-in-golang-a2ee8ed37ec6
for docker build laravel
https://dev.to/er_dward/dockerfile-optimization-using-multistage-builds-caching-and-lightweight-images-2ec6
@vanleantking
vanleantking / xpath find grandparent node contains class name
Created January 9, 2024 16:47
xpath find grandparent node contains class name
xpath find grandparent node contains class name
elem_parent_btn_download = driver.find_element_by_xpath("(//span[contains(.,'Tải về danh sách')])[4]/ancestor::div[contains(@class,'download-button-dropdown')]")
xpath find chidld node:
child_element = element.find_element_by_xpath('./')
child_element = element.find_element_by_xpath('.//')
https://stackoverflow.com/questions/66166788/get-child-element-using-xpath-selenium-python
https://stackoverflow.com/questions/20216541/selenium-find-childs-child-elements
https://stackoverflow.com/questions/68385050/selenium-python-xpath-find-element-that-has-a-child-grandchild
https://stackoverflow.com/questions/43478965/find-out-all-child-elements-xpath-from-parent-xpath-using-selenium-webdriver-in
@vanleantking
vanleantking / redis docker compose
Created December 18, 2023 13:47
redis docker compose
https://stackoverflow.com/questions/70807705/how-to-use-redis-username-with-password-in-docker-compose
https://stackoverflow.com/questions/46569432/does-redis-use-a-username-for-authentication
http://antirez.com/news/96
@vanleantking
vanleantking / regexp email not specific domain company mail
Created November 9, 2023 04:21
regexp email not specific domain company mail
([\w.-]+)@(\[(\d{1,3}\.){3}|(?!hotmail|gmail|googlemail|yahoo|gmx|ymail|outlook|bluewin|protonmail|t\-online|web\.|online\.|aol\.|live\.)(([a-zA-Z\d-]+\.)+))([a-zA-Z]{2,4}|\d{1,3})(\]?)
@vanleantking
vanleantking / ck editor intergrate react
Created October 26, 2023 11:29
ck editor intergrate react
import React, { useRef, useState, useEffect } from "react";
import asset from "plugins/assets/asset";
import CONFIG from "web.config";
const FormData = require("form-data");
const Editor = (props) => {
const editorRef = useRef();
const [editorLoaded, setEditorLoaded] = useState(false);
const { CKEditor } = editorRef.current || {};
git remote prune origin
@vanleantking
vanleantking / config parallel workers run on task schedule apscheduler package python
Last active August 13, 2023 09:42
config parallel workers run on task schedule apscheduler package python
use basic config:
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
executors = {
'default': ThreadPoolExecutor(20),
'processpool': ProcessPoolExecutor(5)
}
job_defaults = {
'coalesce': False,
@vanleantking
vanleantking / docker-fix-no-space-error
Last active May 4, 2023 02:30
docker-fix-no-space-error
https://www.baeldung.com/linux/docker-fix-no-space-error
@vanleantking
vanleantking / sum filter nan mongodb aggregate
Created April 7, 2023 05:50
sum filter nan mongodb aggregate
db.getCollection("fb_report_detail").aggregate([
{"$match":{
"campaign_id":{"$in":["23852528555800329"]},
"adset_id":{"$in":["23852528555870329","23852661751140329"]}}},
{ '$group': {
'_id': '$ad_id',
'inline_link_clicks': {
'$sum': {
'$cond': [
{ '$eq': ['$inline_link_clicks', NaN]},