Skip to content

Instantly share code, notes, and snippets.

View YuniqueUnic's full-sized avatar

Unic YuniqueUnic

View GitHub Profile
@YuniqueUnic
YuniqueUnic / removeAnyDirFile.py
Created September 3, 2024 13:46 — forked from ixuuux/removeAnyDirFile.py
删除任意文件/文件夹。非空文件夹依然可以正确删除。
# -*- coding: utf-8 -*-
import os
def remove_any_dir_file(dir_or_file_path: str) -> None:
""" 删除任意文件/文件夹非空文件夹依然可以正确删除
例如
>>> import os
>>> dir_path = os.path.join(os.getcwd(), 'test')
@YuniqueUnic
YuniqueUnic / send_mail.py
Created September 3, 2024 13:46 — forked from ixuuux/send_mail.py
在Python中发送邮件,不依赖其他第三方库
# -*- coding: utf-8 -*-
"""
File Name : send_mail.py
Create Date : 2020/10/24 15:26
"""
import threading
import smtplib
from email.mime.text import MIMEText
class SendMail:
@YuniqueUnic
YuniqueUnic / playwright_save_mhtml.py
Created September 3, 2024 13:45 — forked from mezhgano/playwright_save_mhtml.py
Save .mhtml web archive using playwright
from playwright.sync_api import sync_playwright
def save_mhtml(path: str, text: str):
with open(path, mode='w', encoding='UTF-8', newline='\n') as file:
file.write(text)
def save_page(url: str, path: str):
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)
@YuniqueUnic
YuniqueUnic / java_download.sh
Created August 14, 2023 15:49 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz