Skip to content

Instantly share code, notes, and snippets.

View aimerneige's full-sized avatar
🎯
Keep Coding

Aimer Neige aimerneige

🎯
Keep Coding
View GitHub Profile
alias aget="aria2c -c -s 16 -x 16 -k 1M -j 16"
@aimerneige
aimerneige / lichess_pgn_parse.py
Created October 1, 2023 07:24
Parse lichess link and get pgn
import re
import io
import chess.pgn
import requests
url = "https://lichess.org/onwfe9NcyG6W"
response = requests.get(url)
html = response.text
pgn_string = re.findall(r'<div class="pgn">(.*?)</div>', html, re.S)[0]
# print(game_pgn)
@aimerneige
aimerneige / speedup_video.py
Last active October 8, 2023 06:11
Speed Up Video 2x faster
import os
from os import listdir
from os.path import isfile, join
current_dir = os.getcwd()
output_dir = os.path.join(current_dir, "out")
try:
os.makedirs(output_dir)
except:
pass
@aimerneige
aimerneige / baidu_ocr.py
Created May 2, 2023 14:25
baidu ocr pyqt
#!/usr/env/bin python3
# -*- coding: utf-8 -*-
# 读取系统文件用
import sys
# base64 编码
import base64
# 网络请求库
import requests
# 枚举类型
@aimerneige
aimerneige / sql2json.py
Last active April 25, 2023 09:59
read database and query all data into json
import os
import mysql.connector
# edit this to your database
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="example",
database="example",
)
@aimerneige
aimerneige / pgn2video.py
Last active April 1, 2023 17:28
conver your pgn to a video (suitable for phoe)
#!/usr/env/bin python3
# -*- coding: utf-8 -*-
import os
import chess
import chess.pgn
import chess.svg
PGN_FILE_PATH = "./sample.pgn"
version: '3'
services:
mysql:
image: mysql:latest
container_name: dev_mysql
restart: always
ports:
- "3306:3306"
volumes:
@aimerneige
aimerneige / gorm-json-example.go
Created March 26, 2023 11:15
Gorm datatypes.JSON Example Code
package main
import (
"encoding/json"
"fmt"
"gorm.io/datatypes"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
@aimerneige
aimerneige / baidu-ocr-with-gui.py
Created March 25, 2023 11:42
PyQt OCR Software With Baidu API
#!/usr/env/bin python3
# -*- coding: utf-8 -*-
import sys
import base64
import requests
from enum import Enum
from PyQt5 import QtCore
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import QSize, pyqtSlot
@aimerneige
aimerneige / ai.go
Created March 16, 2023 08:56
国产 AI 吊打 ChatGPT
package ai
func Ai(q string) string {
if q == "你好" {
return "你好"
} else {
return "对不起,您输入的内容中包含敏感内容,根据相关法律法规,无法给出答复。"
}
}