From 70f8ad025a41c98440053a7e6e5e0740713e5dee Mon Sep 17 00:00:00 2001 From: Akatsuki-Misaki Date: Wed, 22 Jan 2025 13:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 + C/按键计时.c | 112 ++++++ C/时钟.c | 400 ++++++++++++++++++++ PHP/jsd.php | 133 +++++++ Python/Readme.md | 13 + Python/UNPKG/main.py | 145 +++++++ Python/UNPKG/requirements.txt | 20 + Python/Ups-Smtp/Readme.md | 9 + Python/Ups-Smtp/build.py | 8 + Python/Ups-Smtp/ups-test.py | 54 +++ Python/dns-ip/Readme.md | 11 + Python/dns-ip/main.py | 54 +++ Python/ping-logs/Readme.md | 49 +++ Python/ping-logs/main.py | 77 ++++ Python/teamspeak-doownload/README.md | 0 Python/teamspeak-doownload/mian.py | 149 ++++++++ Python/teamspeak-doownload/requirements.txt | 23 ++ Readme.md | 10 + 18 files changed, 1275 insertions(+) create mode 100644 .gitignore create mode 100644 C/按键计时.c create mode 100644 C/时钟.c create mode 100644 PHP/jsd.php create mode 100644 Python/Readme.md create mode 100644 Python/UNPKG/main.py create mode 100644 Python/UNPKG/requirements.txt create mode 100644 Python/Ups-Smtp/Readme.md create mode 100644 Python/Ups-Smtp/build.py create mode 100644 Python/Ups-Smtp/ups-test.py create mode 100644 Python/dns-ip/Readme.md create mode 100644 Python/dns-ip/main.py create mode 100644 Python/ping-logs/Readme.md create mode 100644 Python/ping-logs/main.py create mode 100644 Python/teamspeak-doownload/README.md create mode 100644 Python/teamspeak-doownload/mian.py create mode 100644 Python/teamspeak-doownload/requirements.txt create mode 100644 Readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f180fc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +node_modules +*.spec +config.json +build +dist +@* +Home_ping_log.txt +Server_guangzhou_ping_log.txt \ No newline at end of file diff --git a/C/按键计时.c b/C/按键计时.c new file mode 100644 index 0000000..80d6af7 --- /dev/null +++ b/C/按键计时.c @@ -0,0 +1,112 @@ +#include +typedef unsigned int u16; +typedef unsigned char u8; + +//定义数码管的端口 +sbit D1 = P2^0; +sbit D2 = P2^1; +sbit D3 = P2^2; +sbit D4 = P2^3; +//定义按键的端口 +sbit K3 = P3^2; +sbit K2 = P3^3; +//0~9的段码 +u8 code table[]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90}; +u8 second; +u8 key=0; + +// 1ms*1000=1s +void delay1ms(u16 t) +{ + u16 i,j; + for(i=0;i、ハ _,.ヘ、 /、! + !'〈//`T´', \ `'7'ーr' + レ'ヽL__|___i,___,ンレ|ノ + ト-,/ |___./ + 'ー' !_,.: + +四位数码管STC89C52RC单片机实现简易时钟外加闹钟功能 +Four digital tube STC89C52RC microcontroller to achieve a simple clock plus alarm clock function +创建于2023/6/15 14:13 +Created on 2023/6/15 14:13 +*/ +#include +typedef unsigned int u16; +typedef unsigned char u8; + +//定义数码管的端口 +sbit D1 = P2^0; +sbit D2 = P2^1; +sbit D3 = P2^2; +sbit D4 = P2^3; +//如果D1 = 0则选中 +//如果D1 = 1则不选中 + + +//定义按键的端口 +sbit K3 = P3^5; //切换显示时间和设置时间和设置闹钟的时间 +sbit K4 = P3^4; //切换小时和分钟的时间设置 +sbit K5 = P3^3; //当设置时钟的时间、设置闹钟的时间,用来增加时间、可减少小时和分钟通过K4切换 +sbit K6 = P3^2; //当设置时钟的时间、设置闹钟的时间,用来减少时间、可减少小时和分钟通过K4切换 + +//判断按钮是否按下 +int K3UPdown; +int K4UPdown; +int K5UPdown; +int K6UPdown; + +// 设置默认时间 +//12:00:00 +u8 hour = 12; +u8 minute = 0; + +// 设置默认闹钟时间 +//12:01:00 +u8 bellhour = 12; +u8 bellminute = 1; +u8 bellsecond = 0; + +//默认显示时钟 +u8 timekey = 0; + +//小时和分分钟的切换状态 +u8 Statukey = 0; //Statukey = 0 小时设置、Statukey = 1 分钟设置 +//定义蜂鸣器的端口 +sbit beep = P3^6; +//0~9的段码 +u8 code table[]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90}; //0~9的段码 共阳极数码管 +u8 code tablecode[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0x08,0x03,0x46,0x21,0x06,0x0e};//0~9的段码 共阳极数码管带小数点 +u8 second; +u8 key=0; + +// 1ms*1000=1s +void delay1ms(u16 t) +{ + u16 i,j; + for(i=0;i1){ // 非根目录 + $cdn_file = substr($file, strlen($self_path)); // 去掉开头的目录 +} +$local_path = substr(pathinfo( $cdn_file, PATHINFO_DIRNAME), 1); // 去掉开头的/ +if($local_path && !is_dir($local_path)){ // 目录不存在 + @mkdir($local_path, 755, true); // 创建目录 +} +$url = 'https://cdn.jsdelivr.net' . $cdn_file . $query; // 构造CDN文件URL +$content = curl($url); // 获取文件内容 +if($content){ + header('content-type:'. $mimetype .';charset=utf-8'); // 输出文件头 + file_put_contents(substr($cdn_file, 1), $content); // 保存文件 + exit($content); // 输出文件 +}else{ + header('location: ' .$url ); +} + + +function curl($url) +{ + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_NOSIGNAL, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3000); + curl_setopt($ch, CURLOPT_TIMEOUT_MS, 3000); + if (strpos($url, 'https') !== false) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + } + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36'); + $result = curl_exec($ch); + curl_close($ch); + return $result; +} +/** + * 根据文件后缀获取其mine类型 + * @param string $extension + * @return string + */ + function get_mimetype($extension) { + $ct['htm'] = 'text/html'; + $ct['html'] = 'text/html'; + $ct['txt'] = 'text/plain'; + $ct['asc'] = 'text/plain'; + $ct['bmp'] = 'image/bmp'; + $ct['gif'] = 'image/gif'; + $ct['jpeg'] = 'image/jpeg'; + $ct['jpg'] = 'image/jpeg'; + $ct['jpe'] = 'image/jpeg'; + $ct['png'] = 'image/png'; + $ct['ico'] = 'image/vnd.microsoft.icon'; + $ct['mpeg'] = 'video/mpeg'; + $ct['mpg'] = 'video/mpeg'; + $ct['mpe'] = 'video/mpeg'; + $ct['qt'] = 'video/quicktime'; + $ct['mov'] = 'video/quicktime'; + $ct['avi'] = 'video/x-msvideo'; + $ct['wmv'] = 'video/x-ms-wmv'; + $ct['mp2'] = 'audio/mpeg'; + $ct['mp3'] = 'audio/mpeg'; + $ct['rm'] = 'audio/x-pn-realaudio'; + $ct['ram'] = 'audio/x-pn-realaudio'; + $ct['rpm'] = 'audio/x-pn-realaudio-plugin'; + $ct['ra'] = 'audio/x-realaudio'; + $ct['wav'] = 'audio/x-wav'; + $ct['css'] = 'text/css'; + $ct['zip'] = 'application/zip'; + $ct['pdf'] = 'application/pdf'; + $ct['doc'] = 'application/msword'; + $ct['bin'] = 'application/octet-stream'; + $ct['exe'] = 'application/octet-stream'; + $ct['class'] = 'application/octet-stream'; + $ct['dll'] = 'application/octet-stream'; + $ct['xls'] = 'application/vnd.ms-excel'; + $ct['ppt'] = 'application/vnd.ms-powerpoint'; + $ct['wbxml'] = 'application/vnd.wap.wbxml'; + $ct['wmlc'] = 'application/vnd.wap.wmlc'; + $ct['wmlsc'] = 'application/vnd.wap.wmlscriptc'; + $ct['dvi'] = 'application/x-dvi'; + $ct['spl'] = 'application/x-futuresplash'; + $ct['gtar'] = 'application/x-gtar'; + $ct['gzip'] = 'application/x-gzip'; + $ct['js'] = 'application/javascript'; + $ct['swf'] = 'application/x-shockwave-flash'; + $ct['tar'] = 'application/x-tar'; + $ct['7z'] = 'application/x7zcompressed'; + $ct['rar'] = 'application/x-rar-compressed'; + $ct['xhtml'] = 'application/xhtml+xml'; + $ct['au'] = 'audio/basic'; + $ct['snd'] = 'audio/basic'; + $ct['midi'] = 'audio/midi'; + $ct['mid'] = 'audio/midi'; + $ct['m3u'] = 'audio/x-mpegurl'; + $ct['tiff'] = 'image/tiff'; + $ct['tif'] = 'image/tiff'; + $ct['rtf'] = 'text/rtf'; + $ct['wml'] = 'text/vnd.wap.wml'; + $ct['wmls'] = 'text/vnd.wap.wmlscript'; + $ct['xsl'] = 'text/xml'; + $ct['xml'] = 'text/xml'; + + return isset($ct[strtolower($extension)]) ? $ct[strtolower($extension)] : 'text/html'; +} \ No newline at end of file diff --git a/Python/Readme.md b/Python/Readme.md new file mode 100644 index 0000000..1ed8627 --- /dev/null +++ b/Python/Readme.md @@ -0,0 +1,13 @@ +# 自己搞的小东西 + +- 不建议使用,性能极差 + +- 如果你非要用 + +- 你可以使用下面的命令进行打包可在所有电脑运行 + + +```python +pyinstaller --onefile main.py +``` + diff --git a/Python/UNPKG/main.py b/Python/UNPKG/main.py new file mode 100644 index 0000000..aa9b991 --- /dev/null +++ b/Python/UNPKG/main.py @@ -0,0 +1,145 @@ +import requests +import re +import os +import shutil +import time +from requests.adapters import HTTPAdapter +from urllib3.util.retry import Retry + +# 配置 +url = "https://unpkg.ovofish.com/" +headers = { + 'Accept-Language': 'zh-CN,zh;q=0.8', + 'Content-Type': 'text/html; Charset=utf-8', + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36" +} + +# 输入模块名 +mod = input("请输入模块名:") + +# 设置重试机制 +def requests_retry_session( + retries=3, + backoff_factor=0.3, + status_forcelist=(500, 502, 504), + session=None, + proxies=None +): + session = session or requests.Session() + retry = Retry( + total=retries, + read=retries, + connect=retries, + backoff_factor=backoff_factor, + status_forcelist=status_forcelist, + ) + adapter = HTTPAdapter(max_retries=retry) + session.mount('http://', adapter) + session.mount('https://', adapter) + if proxies: + session.proxies.update(proxies) + return session + +# 获取HTML +def getHTML(url, encoding='utf-8', proxies=None): + try: + with requests_retry_session(proxies=proxies).get(url, headers=headers) as rd: + rd.encoding = encoding + rd.raise_for_status() + return rd.text + except requests.exceptions.RequestException as e: + print(f"获取HTML时发生错误: {e}") + return None + +# 获取版本 +def getVsions(m, proxies=None): + h = getHTML(url + m + '/', proxies=proxies) + j = re.findall(r'