Selenium infinite scrolling to bottom using python

4 记录 Leave a Comment
We have 3 kinds of infinite scrolling to bottom while using selenium. Simply scrolling - Stop until there is no more content. Meet scrolling - Stop until we meet a speciy element. Partial scrolling - Scrolling content in specify html container, stop until there are no more content. All these 3 scenses will use …

How to install OS and connect to NanoPi-R2S (rk3328)

7 记录 Leave a Comment
Official wiki page OS image on Google Drive Install OS Go to google drive, navigate to: 01_Official images/01_SD card images. Download any image, e.g., "rk3328-sd-debian-bullseye-core-5.15-arm64-20230529.img.gz". Unzip it to "rk3328-sd-debian-bullseye-core-5.15-arm64-20230529.img". importat…

What is OpenAI Function Calling and How to Use it?

63 记录 1 Comment
Simply put, OpenAI / ChatGPT function calling can identify the intent and entities in a sentence through a language model. For example, when the user asks "I want to recharge my phone100 USD". The model should recognize the intent recharge and it's 2 entities recharge amont: 100 currency:USD Back to O…

A script to test MySQL port is running

52 记录 Leave a Comment
#!/bin/bash ip="<MySQL HOST>" port="<MySQL PORT>" output_file="<Log File Path>" while : do nc -zv "$ip" "$port" > /dev/null datetime=$(date +"%Y-%m-%d %H:%M:%S") if [ $? -eq 0 ]; then echo "$datetime: Port $port is open on $ip…

From PHP to Python In 10 Minutes

64 记录 Leave a Comment
PHP and Python are both high-level, interpreted programming languages with a variety of applications, but they have some significant differences in terms of syntax, design philosophy, and use cases. Here's a detailed comparison of the two languages: 1. Purpose and Use Cases PHP: Created by Rasmus Lerdorf in 199…

How to compress mp4 in one command with ffmpeg

50 记录 Leave a Comment
With ffmpeg, we can create a free video compresser on our local machine. First, create a shell function on you .bashrc or .zshrc: function mp4-compress() { filename=$(basename -- "$1") extension="${filename##*.}" name="${filename%.*}" ffmpeg -i "$1" -vcodec libx265 -crf 2…

How to transfer data between different mongodb instance?

45 记录 Leave a Comment
Here is the python code to transfer data between different mongo instance: def transfer(source_collection, dest_collection, batch_size: int): offset = 0 total = source_collection.count_documents({}) total_inserted = 0 while True: documents = source_collection.find().skip(offset).limit(batch_size) data = list(do…
Next Page »