数据库数据更新

This commit is contained in:
landaiqing committed 2023-07-11 11:08:11 +08:00
1 parent ad88989c72
commit 5babd9f64f
1 file changed
+50 -10
+50 -10
View File
@@ -11,7 +11,7 @@
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 10/07/2023 23:35:48
Date: 11/07/2023 11:07:38
*/
SET NAMES utf8mb4;
@@ -33,7 +33,7 @@ CREATE TABLE `admin` (
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES (1, 'admin', 'admin', 1, '2023-07-10 23:31:54');
INSERT INTO `admin` VALUES (1, 'admin', 'admin', 1, '2023-07-11 10:54:46');
INSERT INTO `admin` VALUES (9, '666', '666', 0, '2023-07-10');
-- ----------------------------
@@ -56,8 +56,8 @@ CREATE TABLE `article` (
-- ----------------------------
-- Records of article
-- ----------------------------
INSERT INTO `article` VALUES (30, 13, '<p>优秀的导航项目,优质的导航站搜集整理:<a href=\"https://github.com/eryajf/awesome-navigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/eryajf/awesome-navigation</a></p><p>nav: ? 发现导航</p><p><a href=\"https://github.com/xjh22222228/nav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/xjh22222228/nav</a></p><p>WebStackPage</p><p><a href=\"https://github.com/WebStackPage/WebStackPage.github.io\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/WebStackPage/WebStackPage.github.io</a></p><p>hexo-theme-webstack 一个基于webstack的hexo主题。</p><p><a href=\"https://github.com/HCLonely/hexo-theme-webstack\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/HCLonely/hexo-theme-webstack</a></p><p>WebStack-Hugo 一键配置的纯静态网址导航网站</p><p><a href=\"https://github.com/shenweiyan/WebStack-Hugo\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/shenweiyan/WebStack-Hugo</a></p><p>typecho 导航主题Webstack</p><p><a href=\"https://www.zmki.cn/5366.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://www.zmki.cn/5366.html</a></p><p>onenav: 书签管理系统</p><p><a href=\"https://github.com/helloxz/onenav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/helloxz/onenav</a></p><p>geek-navigation: ❤️ 极客猿导航</p><p><a href=\"https://github.com/geekape/geek-navigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/geekape/geek-navigation</a></p><p>aNavigation:</p><p><a href=\"https://github.com/Jackie1123/aNavigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/Jackie1123/aNavigation</a></p><p>team-nav:</p><p><a href=\"https://github.com/tuituidan/team-nav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/tuituidan/team-nav</a></p><p>daohang: 运维导航系统</p><p><a href=\"https://github.com/zhuima/daohang\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/zhuima/daohang</a></p><p> 【来源:<a href=\"https://landaiqing.space/451.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://landaiqing.space/451.html</a>,转载请注明】</p>', '2023-07-10', 1, 6, '优秀的导航项目,优质的导航站搜集整', 'https://pic.imgdb.cn/item/64107dd8ebf10e5d538b2f3b.jpg');
INSERT INTO `article` VALUES (31, 12, '<p>推荐一款支持谷歌插件,微软插件的手机浏览器~</p><p>站长我使用的也是这款手机浏览器,还是比较好用的,界面简单优雅!</p><p>而且关键还支持Tampermonkey哦!!!</p><p>下载地址:</p><p><a href=\"https://lemurbrowser.com/app/zh/\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://lemurbrowser.com/app/zh/</a></p><p> 【来源:<a href=\"https://landaiqing.space/436.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://landaiqing.space/436.html</a>,转载请注明】</p>', '2023-07-10', 1, 7, '推荐一个支持谷歌插件,微软插件的手机浏览器~', 'https://pic.imgdb.cn/item/640f214ef144a01007e4e317.jpg');
INSERT INTO `article` VALUES (30, 13, '<p>优秀的导航项目,优质的导航站搜集整理:<a href=\"https://github.com/eryajf/awesome-navigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/eryajf/awesome-navigation</a></p><p>nav: ? 发现导航</p><p><a href=\"https://github.com/xjh22222228/nav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/xjh22222228/nav</a></p><p>WebStackPage</p><p><a href=\"https://github.com/WebStackPage/WebStackPage.github.io\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/WebStackPage/WebStackPage.github.io</a></p><p>hexo-theme-webstack 一个基于webstack的hexo主题。</p><p><a href=\"https://github.com/HCLonely/hexo-theme-webstack\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/HCLonely/hexo-theme-webstack</a></p><p>WebStack-Hugo 一键配置的纯静态网址导航网站</p><p><a href=\"https://github.com/shenweiyan/WebStack-Hugo\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/shenweiyan/WebStack-Hugo</a></p><p>typecho 导航主题Webstack</p><p><a href=\"https://www.zmki.cn/5366.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://www.zmki.cn/5366.html</a></p><p>onenav: 书签管理系统</p><p><a href=\"https://github.com/helloxz/onenav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/helloxz/onenav</a></p><p>geek-navigation: ❤️ 极客猿导航</p><p><a href=\"https://github.com/geekape/geek-navigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/geekape/geek-navigation</a></p><p>aNavigation:</p><p><a href=\"https://github.com/Jackie1123/aNavigation\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/Jackie1123/aNavigation</a></p><p>team-nav:</p><p><a href=\"https://github.com/tuituidan/team-nav\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/tuituidan/team-nav</a></p><p>daohang: 运维导航系统</p><p><a href=\"https://github.com/zhuima/daohang\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://github.com/zhuima/daohang</a></p><p> 【来源:<a href=\"https://landaiqing.space/451.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://landaiqing.space/451.html</a>,转载请注明】</p>', '2023-07-10', 1, 10, '优秀的导航项目,优质的导航站搜集整', 'https://pic.imgdb.cn/item/64107dd8ebf10e5d538b2f3b.jpg');
INSERT INTO `article` VALUES (31, 12, '<p>推荐一款支持谷歌插件,微软插件的手机浏览器~</p><p>站长我使用的也是这款手机浏览器,还是比较好用的,界面简单优雅!</p><p>而且关键还支持Tampermonkey哦!!!</p><p>下载地址:</p><p><a href=\"https://lemurbrowser.com/app/zh/\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://lemurbrowser.com/app/zh/</a></p><p> 【来源:<a href=\"https://landaiqing.space/436.html\" target=\"_blank\" ref=\"nofollow noopener noreferrer\">https://landaiqing.space/436.html</a>,转载请注明】</p>', '2023-07-10', 1, 8, '推荐一个支持谷歌插件,微软插件的手机浏览器~', 'https://pic.imgdb.cn/item/640f214ef144a01007e4e317.jpg');
-- ----------------------------
-- Table structure for category
@@ -116,7 +116,7 @@ CREATE TABLE `comment` (
-- ----------------------------
-- Records of comment
-- ----------------------------
INSERT INTO `comment` VALUES (49, 13, 26, '可以,666', 0, '2023-07-10 20:31:59', 1, 5, '2023-07-10 20:31:59', 0);
INSERT INTO `comment` VALUES (49, 13, 26, '可以', 0, '2023-07-10 20:31:59', 1, 5, '2023-07-10 20:31:59', 0);
-- ----------------------------
-- Table structure for githubinfo
@@ -141,7 +141,7 @@ CREATE TABLE `githubinfo` (
`isVaild` int NULL DEFAULT NULL COMMENT '是否有效',
PRIMARY KEY (`id`) USING BTREE,
INDEX `projectId_info`(`projectId` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of githubinfo
@@ -150,6 +150,46 @@ INSERT INTO `githubinfo` VALUES (23, 27, 'https://avatars.githubusercontent.com/
INSERT INTO `githubinfo` VALUES (24, 26, 'https://avatars.githubusercontent.com/u/3266363?v=4', 'awesome-macos-screensavers', 'https://starchart.cc/agarrharr/awesome-macos-screensavers.svg', 3180, '无', 'true', 80, 4, 'User', 'master', 129, '无', '0', 0);
INSERT INTO `githubinfo` VALUES (25, 42, 'https://avatars.githubusercontent.com/u/65466868?v=4', 'devpod', 'https://starchart.cc/loft-sh/devpod.svg', 3233, 'Go', 'true', 21, 69, 'Organization', 'main', 137, 'MPL-2.0', '0', 0);
INSERT INTO `githubinfo` VALUES (26, 43, 'https://avatars.githubusercontent.com/u/69631?v=4', 'redex', 'https://starchart.cc/facebook/redex.svg', 5854, 'C++', 'true', 229, 70, 'Organization', 'main', 671, 'MIT', '0', 0);
INSERT INTO `githubinfo` VALUES (27, 32, 'https://avatars.githubusercontent.com/u/65466868?v=4', 'devpod', 'https://starchart.cc/loft-sh/devpod.svg', 3239, 'Go', 'true', 21, 69, 'Organization', 'main', 137, 'MPL-2.0', '0', 0);
-- ----------------------------
-- Table structure for onefile
-- ----------------------------
DROP TABLE IF EXISTS `onefile`;
CREATE TABLE `onefile` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
`oneFile_Name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称',
`language` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '语言',
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
`userId` int NULL DEFAULT NULL COMMENT '作者ID',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '访问地址',
`lookNum` int NULL DEFAULT NULL COMMENT '观看数',
`Content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '内容',
`isValid` int NULL DEFAULT NULL COMMENT '是否有效',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of onefile
-- ----------------------------
INSERT INTO `onefile` VALUES (1, 'tinyhttpd.c', 'C', '不到 500 行的超轻量型 HTTP Server,可以用来理解服务器程序的原理和本质', 12, 'https://github.com/EZLippi/Tinyhttpd', 1111, '/* J. David\'s webserver */\r\n/* This is a simple webserver.\r\n * Created November 1999 by J. David Blackstone.\r\n * CSE 4344 (Network concepts), Prof. Zeigler\r\n * University of Texas at Arlington\r\n */\r\n/* This program compiles for Sparc Solaris 2.6.\r\n * To compile for Linux:\r\n * 1) Comment out the #include <pthread.h> line.\r\n * 2) Comment out the line that defines the variable newthread.\r\n * 3) Comment out the two lines that run pthread_create().\r\n * 4) Uncomment the line that runs accept_request().\r\n * 5) Remove -lsocket from the Makefile.\r\n */\r\n#include <stdio.h>\r\n#include <sys/socket.h>\r\n#include <sys/types.h>\r\n#include <netinet/in.h>\r\n#include <arpa/inet.h>\r\n#include <unistd.h>\r\n#include <ctype.h>\r\n#include <strings.h>\r\n#include <string.h>\r\n#include <sys/stat.h>\r\n#include <pthread.h>\r\n#include <sys/wait.h>\r\n#include <stdlib.h>\r\n#include <stdint.h>\r\n\r\n#define ISspace(x) isspace((int)(x))\r\n\r\n#define SERVER_STRING \"Server: jdbhttpd/0.1.0\\r\\n\"\r\n#define STDIN 0\r\n#define STDOUT 1\r\n#define STDERR 2\r\n\r\nvoid accept_request(void *);\r\nvoid bad_request(int);\r\nvoid cat(int, FILE *);\r\nvoid cannot_execute(int);\r\nvoid error_die(const char *);\r\nvoid execute_cgi(int, const char *, const char *, const char *);\r\nint get_line(int, char *, int);\r\nvoid headers(int, const char *);\r\nvoid not_found(int);\r\nvoid serve_file(int, const char *);\r\nint startup(u_short *);\r\nvoid unimplemented(int);\r\n\r\n/**********************************************************************/\r\n/* A request has caused a call to accept() on the server port to\r\n * return. Process the request appropriately.\r\n * Parameters: the socket connected to the client */\r\n/**********************************************************************/\r\nvoid accept_request(void *arg)\r\n{\r\n int client = (intptr_t)arg;\r\n char buf[1024];\r\n size_t numchars;\r\n char method[255];\r\n char url[255];\r\n char path[512];\r\n size_t i, j;\r\n struct stat st;\r\n int cgi = 0; /* becomes true if server decides this is a CGI\r\n * program */\r\n char *query_string = NULL;\r\n\r\n numchars = get_line(client, buf, sizeof(buf));\r\n i = 0; j = 0;\r\n while (!ISspace(buf[i]) && (i < sizeof(method) - 1))\r\n {\r\n method[i] = buf[i];\r\n i++;\r\n }\r\n j=i;\r\n method[i] = \'\\0\';\r\n\r\n if (strcasecmp(method, \"GET\") && strcasecmp(method, \"POST\"))\r\n {\r\n unimplemented(client);\r\n return;\r\n }\r\n\r\n if (strcasecmp(method, \"POST\") == 0)\r\n cgi = 1;\r\n\r\n i = 0;\r\n while (ISspace(buf[j]) && (j < numchars))\r\n j++;\r\n while (!ISspace(buf[j]) && (i < sizeof(url) - 1) && (j < numchars))\r\n {\r\n url[i] = buf[j];\r\n i++; j++;\r\n }\r\n url[i] = \'\\0\';\r\n\r\n if (strcasecmp(method, \"GET\") == 0)\r\n {\r\n query_string = url;\r\n while ((*query_string != \'?\') && (*query_string != \'\\0\'))\r\n query_string++;\r\n if (*query_string == \'?\')\r\n {\r\n cgi = 1;\r\n *query_string = \'\\0\';\r\n query_string++;\r\n }\r\n }\r\n\r\n sprintf(path, \"htdocs%s\", url);\r\n if (path[strlen(path) - 1] == \'/\')\r\n strcat(path, \"index.html\");\r\n if (stat(path, &st) == -1) {\r\n while ((numchars > 0) && strcmp(\"\\n\", buf)) /* read & discard headers */\r\n numchars = get_line(client, buf, sizeof(buf));\r\n not_found(client);\r\n }\r\n else\r\n {\r\n if ((st.st_mode & S_IFMT) == S_IFDIR)\r\n strcat(path, \"/index.html\");\r\n if ((st.st_mode & S_IXUSR) ||\r\n (st.st_mode & S_IXGRP) ||\r\n (st.st_mode & S_IXOTH) )\r\n cgi = 1;\r\n if (!cgi)\r\n serve_file(client, path);\r\n else\r\n execute_cgi(client, path, method, query_string);\r\n }\r\n\r\n close(client);\r\n}\r\n\r\n/**********************************************************************/\r\n/* Inform the client that a request it has made has a problem.\r\n * Parameters: client socket */\r\n/**********************************************************************/\r\nvoid bad_request(int client)\r\n{\r\n char buf[1024];\r\n\r\n sprintf(buf, \"HTTP/1.0 400 BAD REQUEST\\r\\n\");\r\n send(client, buf, sizeof(buf), 0);\r\n sprintf(buf, \"Content-type: text/html\\r\\n\");\r\n send(client, buf, sizeof(buf), 0);\r\n sprintf(buf, \"\\r\\n\");\r\n send(client, buf, sizeof(buf), 0);\r\n sprintf(buf, \"<P>Your browser sent a bad request, \");\r\n send(client, buf, sizeof(buf), 0);\r\n Line truncated
INSERT INTO `onefile` VALUES (2, 'si78c', 'C', '用 C 语言实现的《太空侵略者》命令行游戏', 12, 'https://github.com/loadzero/si78c', 9500, '//\r\n// Space Invaders 1978 in C\r\n// Jason McSweeney\r\n\r\n#define _XOPEN_SOURCE\r\n\r\n#include <stdio.h>\r\n#include <stdarg.h>\r\n#include <stdlib.h>\r\n#include <ucontext.h>\r\n#include <stdint.h>\r\n#include <assert.h>\r\n#include <SDL.h>\r\n#include <assert.h>\r\n#include <string.h>\r\n\r\n#define OP_BLEND 0\r\n#define OP_ERASE 1\r\n#define OP_COLLIDE 2\r\n#define OP_BLIT 3\r\n\r\n#define SHOT_ACTIVE 0x80\r\n#define SHOT_BLOWUP 0x1\r\n\r\n#define BEAM_VBLANK 0x80\r\n#define BEAM_MIDDLE 0x00\r\n#define XR_MID 0x80\r\n\r\n#define DIP3_SHIPS1 0x1\r\n#define DIP5_SHIPS2 0x2\r\n#define DIP6_BONUS 0x8\r\n#define DIP7_COININFO 0x80\r\n\r\n#define TILT_BIT 0x4\r\n#define COIN_BIT 0x1\r\n\r\n#define INIT 1\r\n#define PROMPT 2\r\n#define SHIELDS 4\r\n\r\n#define ROL_SHOT_PICEND 0xf9\r\n#define PLU_SHOT_PICEND 0xed\r\n#define SQU_SHOT_PICEND 0xdb\r\n\r\n#define PLAYER_ADDR 0x2010\r\n#define PLAYER_SIZE 16\r\n#define PLAYER_SHOT_ADDR 0x2020\r\n#define PLAYER_SHOT_DATA_ADDR 0x2025\r\n#define PLAYER_SHOT_DATA_SIZE 7\r\n#define ROLLING_SHOT_ADDR 0x2030\r\n#define ROLLING_SHOT_SIZE 16\r\n#define PLUNGER_SHOT_ADDR 0x2040\r\n#define PLUNGER_SHOT_SIZE 16\r\n#define SQUIGGLY_SHOT_ADDR 0x2050\r\n#define SQUIGGLY_SHOT_SIZE 16\r\n#define SAUCER_ADDR 0x2083\r\n#define SAUCER_SIZE 10\r\n#define P1_ADDR 0x2100\r\n#define P2_ADDR 0x2200\r\n#define SPLASH_DESC_ADDR 0x20c5\r\n\r\n#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__\r\n#error \"This code is Little Endian only.\"\r\n#endif\r\n\r\nstruct Word\r\n{\r\n union {\r\n\r\n uint16_t u16;\r\n struct {\r\n uint8_t l;\r\n uint8_t h;\r\n };\r\n\r\n struct {\r\n uint8_t y;\r\n uint8_t x;\r\n };\r\n\r\n };\r\n} __attribute__ ((packed)); // 4\r\n\r\ntypedef struct Word Word;\r\n\r\nstruct SprDesc\r\n{\r\n Word spr;\r\n\r\n union {\r\n Word pos; // pixel position\r\n Word sc; // screen address\r\n };\r\n\r\n uint8_t n;\r\n\r\n} __attribute__ ((packed)); // 5\r\n\r\ntypedef struct SprDesc SprDesc;\r\n\r\nstruct GameObjHeader\r\n{\r\n uint8_t TimerMSB;\r\n uint8_t TimerLSB;\r\n uint8_t TimerExtra;\r\n Word Handler;\r\n\r\n} __attribute__ ((packed)); // 5\r\n\r\ntypedef struct GameObjHeader GameObjHeader;\r\n\r\nstruct AShot\r\n{\r\n uint8_t Status;\r\n uint8_t StepCnt;\r\n uint8_t Track;\r\n Word CFir;\r\n uint8_t BlowCnt;\r\n SprDesc Desc;\r\n\r\n} __attribute__ ((packed)); // 11\r\n\r\ntypedef struct AShot AShot;\r\n\r\nstruct Mem {\r\n\r\nuint8_t pad_01[3063]; // 0x0000\r\nuint8_t MSG_TAITO_COP[9]; // 0x0bf7\r\nuint8_t pad_02[3601]; // 0x0c00\r\nuint8_t soundDelayKey[16]; // 0x1a11\r\nuint8_t soundDelayValue[16]; // 0x1a21\r\nuint8_t pad_03[112]; // 0x1a31\r\nuint8_t ShotReloadRate[5]; // 0x1aa1\r\nuint8_t MSG_GAME_OVER__PLAYER___[20]; // 0x1aa6\r\nuint8_t MSG_1_OR_2PLAYERS_BUTTON[20]; // 0x1aba\r\nuint8_t pad_04; // 0x1ace\r\nuint8_t MSG_ONLY_1PLAYER__BUTTON[20]; // 0x1acf\r\nuint8_t pad_05; // 0x1ae3\r\nuint8_t MSG__SCORE_1__HI_SCORE_SCORE_2__[28]; // 0x1ae4\r\nuint8_t pad_06[112]; // 0x1b00\r\nuint8_t MSG_PLAY_PLAYER_1_[14]; // 0x1b70\r\nuint8_t pad_07[66]; // 0x1b7e\r\nuint8_t SPLASH_SHOT_OBJDATA[16]; // 0x1bc0\r\nuint8_t pad_08[144]; // 0x1bd0\r\nuint8_t PLAYER_SPRITES[48]; // 0x1c60\r\nuint8_t pad_09[9]; // 0x1c90\r\nuint8_t MSG__10_POINTS[10]; // 0x1c99\r\nuint8_t MSG__SCORE_ADVANCE_TABLE_[21]; // 0x1ca3\r\nuint8_t AReloadScoreTab[4]; // 0x1cb8\r\nuint8_t MSG_TILT[4]; // 0x1cbc\r\nuint8_t pad_10[28]; // 0x1cc0\r\nuint8_t AlienShotExplodingSprite[6]; // 0x1cdc\r\nuint8_t pad_11[24]; // 0x1ce2\r\nuint8_t MSG_PLAY2[5]; // 0x1cfa\r\nuint8_t pad_12[33]; // 0x1cff\r\nLine truncated
INSERT INTO `onefile` VALUES (3, 'minilisp', 'C', '用 C 语言写的 Lisp 解释器。实现了整数、符号、局部变量、条件语句、宏和垃圾回收等功能', 12, 'https://github.com/rui314/minilisp', 7600, '// This software is in the public domain.\r\n\r\n#include <assert.h>\r\n#include <ctype.h>\r\n#include <stdarg.h>\r\n#include <stdbool.h>\r\n#include <stddef.h>\r\n#include <stdint.h>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <sys/mman.h>\r\n\r\nstatic __attribute((noreturn)) void error(char *fmt, ...) {\r\n va_list ap;\r\n va_start(ap, fmt);\r\n vfprintf(stderr, fmt, ap);\r\n fprintf(stderr, \"\\n\");\r\n va_end(ap);\r\n exit(1);\r\n}\r\n\r\n//======================================================================\r\n// Lisp objects\r\n//======================================================================\r\n\r\n// The Lisp object type\r\nenum {\r\n // Regular objects visible from the user\r\n TINT = 1,\r\n TCELL,\r\n TSYMBOL,\r\n TPRIMITIVE,\r\n TFUNCTION,\r\n TMACRO,\r\n TENV,\r\n // The marker that indicates the object has been moved to other location by GC. The new location\r\n // can be found at the forwarding pointer. Only the functions to do garbage collection set and\r\n // handle the object of this type. Other functions will never see the object of this type.\r\n TMOVED,\r\n // Const objects. They are statically allocated and will never be managed by GC.\r\n TTRUE,\r\n TNIL,\r\n TDOT,\r\n TCPAREN,\r\n};\r\n\r\n// Typedef for the primitive function\r\nstruct Obj;\r\ntypedef struct Obj *Primitive(void *root, struct Obj **env, struct Obj **args);\r\n\r\n// The object type\r\ntypedef struct Obj {\r\n // The first word of the object represents the type of the object. Any code that handles object\r\n // needs to check its type first, then access the following union members.\r\n int type;\r\n\r\n // The total size of the object, including \"type\" field, this field, the contents, and the\r\n // padding at the end of the object.\r\n int size;\r\n\r\n // Object values.\r\n union {\r\n // Int\r\n int value;\r\n // Cell\r\n struct {\r\n struct Obj *car;\r\n struct Obj *cdr;\r\n };\r\n // Symbol\r\n char name[1];\r\n // Primitive\r\n Primitive *fn;\r\n // Function or Macro\r\n struct {\r\n struct Obj *params;\r\n struct Obj *body;\r\n struct Obj *env;\r\n };\r\n // Environment frame. This is a linked list of association lists\r\n // containing the mapping from symbols to their value.\r\n struct {\r\n struct Obj *vars;\r\n struct Obj *up;\r\n };\r\n // Forwarding pointer\r\n void *moved;\r\n };\r\n} Obj;\r\n\r\n// Constants\r\nstatic Obj *True = &(Obj){ TTRUE };\r\nstatic Obj *Nil = &(Obj){ TNIL };\r\nstatic Obj *Dot = &(Obj){ TDOT };\r\nstatic Obj *Cparen = &(Obj){ TCPAREN };\r\n\r\n// The list containing all symbols. Such data structure is traditionally called the \"obarray\", but I\r\n// avoid using it as a variable name as this is not an array but a list.\r\nstatic Obj *Symbols;\r\n\r\n//======================================================================\r\n// Memory management\r\n//======================================================================\r\n\r\n// The size of the heap in byte\r\n#define MEMORY_SIZE 65536\r\n\r\n// The pointer pointing to the beginning of the current heap\r\nstatic void *memory;\r\n\r\n// The pointer pointing to the beginning of the old heap\r\nstatic void *from_space;\r\n\r\n// The number of bytes allocated from the heap\r\nstatic size_t mem_nused = 0;\r\n\r\n// Flags to debug GC\r\nstatic bool gc_running = false;\r\nstatic bool debug_gc = false;\r\nstatic bool always_gc = false;\r\n\r\nstatic void gc(void *root);\r\n\r\n// Currently we are using Cheney\'s copying GC algorithm, with which the available memory is split\r\n// into two halves and all objects are moved from one half to another every time GC is invoked. That\r\n// means the address of the object keeps changing. If you take the address of an object and keep it\r\n// in a C variable, dereferencing it could cause SEGV because the address becomes invalid after GC\r\n// runs.\r\n//\r\n// In order to deal with that, all access from C to Lisp objects will go through two levels of\r\n// pointer dereferences. The C local variable is pointing to a pointer on the C stack, and the\r\n// pointer is pointing to the Lisp object. GC is aware of the pointers in the stack and updates\r\n// their contents with the objects\' new addresses when GC happens.\r\n//\r\n// The following is a macro to reserve the area in the C stack for the pointers. The contents of\r\n// this area are considered to be GC root.\r\n//\r\n// Be careful not to bypass the two levels of pointer indirectionsLine truncated
INSERT INTO `onefile` VALUES (4, 'cJSON', 'C', '标准 C(C89) 实现的超轻量的 JSON 解析库\r\n', 12, 'https://github.com/DaveGamble/cJSON', 180, '/*\r\n Copyright (c) 2009-2017 Dave Gamble and cJSON contributors\r\n\r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n The above copyright notice and this permission notice shall be included in\r\n all copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n THE SOFTWARE.\r\n*/\r\n\r\n/* cJSON */\r\n/* JSON parser in C. */\r\n\r\n/* disable warnings about old C89 functions in MSVC */\r\n#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)\r\n#define _CRT_SECURE_NO_DEPRECATE\r\n#endif\r\n\r\n#ifdef __GNUC__\r\n#pragma GCC visibility push(default)\r\n#endif\r\n#if defined(_MSC_VER)\r\n#pragma warning (push)\r\n/* disable warning about single line comments in system headers */\r\n#pragma warning (disable : 4001)\r\n#endif\r\n\r\n#include <string.h>\r\n#include <stdio.h>\r\n#include <math.h>\r\n#include <stdlib.h>\r\n#include <limits.h>\r\n#include <ctype.h>\r\n#include <float.h>\r\n\r\n#ifdef ENABLE_LOCALES\r\n#include <locale.h>\r\n#endif\r\n\r\n#if defined(_MSC_VER)\r\n#pragma warning (pop)\r\n#endif\r\n#ifdef __GNUC__\r\n#pragma GCC visibility pop\r\n#endif\r\n\r\n#include \"cJSON.h\"\r\n\r\n/* define our own boolean type */\r\n#ifdef true\r\n#undef true\r\n#endif\r\n#define true ((cJSON_bool)1)\r\n\r\n#ifdef false\r\n#undef false\r\n#endif\r\n#define false ((cJSON_bool)0)\r\n\r\n/* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */\r\n#ifndef isinf\r\n#define isinf(d) (isnan((d - d)) && !isnan(d))\r\n#endif\r\n#ifndef isnan\r\n#define isnan(d) (d != d)\r\n#endif\r\n\r\n#ifndef NAN\r\n#ifdef _WIN32\r\n#define NAN sqrt(-1.0)\r\n#else\r\n#define NAN 0.0/0.0\r\n#endif\r\n#endif\r\n\r\ntypedef struct {\r\n const unsigned char *json;\r\n size_t position;\r\n} error;\r\nstatic error global_error = { NULL, 0 };\r\n\r\nCJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void)\r\n{\r\n return (const char*) (global_error.json + global_error.position);\r\n}\r\n\r\nCJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item)\r\n{\r\n if (!cJSON_IsString(item))\r\n {\r\n return NULL;\r\n }\r\n\r\n return item->valuestring;\r\n}\r\n\r\nCJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item)\r\n{\r\n if (!cJSON_IsNumber(item))\r\n {\r\n return (double) NAN;\r\n }\r\n\r\n return item->valuedouble;\r\n}\r\n\r\n/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */\r\n#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 15)\r\n #error cJSON.h and cJSON.c have different versions. Make sure that both have the same.\r\n#endif\r\n\r\nCJSON_PUBLIC(const char*) cJSON_Version(void)\r\n{\r\n static char version[15];\r\n sprintf(version, \"%i.%i.%i\", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH);\r\n\r\n return version;\r\n}\r\n\r\n/* Case insensitive string comparison, doesn\'t consider two NULL pointers equal though */\r\nstatic int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2)\r\n{\r\n if ((string1 == NULL) || (string2 == NULL))\r\n {\r\n return 1;\r\n }\r\n\r\n if (string1 == string2)\r\n {\r\n return 0;\r\n }\r\n\r\n for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++)\r\n {\r\n if (*string1 == \'\\0\')\r\n {\r\n return 0;\r\n }\r\n }\r\n\r\n return tolower(*string1) - tolower(*string2);\r\n}\r\n\r\ntypedef struct internal_hooks\r\n{\r\n void *(CJSON_CDECL *allocate)(size_t size);\r\n void (CJSON_CDECL *deallocate)(void *pointer);\r\n void *(CJSON_CDECL *reallocate)(void *pointer, size_t size);\r\n} internal_hooks;\r\n\r\n#if defined(_MSC_VER)\r\n/* work around MSVC error C2322: \'...\' address of dllimport \'...\' is not static */\r\nstatic void * CJSON_CDECL internal_malloc(size_t size)\r\n{\r\n return malloc(size);\r\n}\r\nstaLine truncated
INSERT INTO `onefile` VALUES (5, 'filedb', 'C', '基于B-tree 的文件数据库', 12, 'https://github.com/LiuYuguang/supersimplefiledatabase', 202, '/*\r\n * Copyright (C) 2022, LiuYuguang <l13660020946@live.com>\r\n */\r\n/**\r\n * @brief 超简单的文件数据库\r\n */\r\n\r\n#include <stddef.h> // for size_t\r\n#include <stdlib.h> // for malloc(), free()\r\n#include <string.h> // for memcpy(), memmove(), strcpy(), strlen()\r\n#include <fcntl.h> // for open(), O_CREAT, O_RDWR, O_TRUNC\r\n#include <sys/stat.h> // for struct stat, fstat()\r\n#include <unistd.h> // for pread(), pwrite(), access(), ftruncate(), close()\r\n#include <stdint.h> // for int32_t\r\n#include <errno.h> // for E2BIG\r\n\r\n#define DB_HEAD_SIZE (4096UL) // head size must be pow of 2! 文件数据库的头大小\r\n#define DB_BLOCK_SIZE (8192UL) // block size must be pow of 2! 文件数据库的数据块大小\r\n\r\n#define BTREE_NON_LEAF 0 /** 非叶子节点 */\r\n#define BTREE_LEAF 1 /** 叶子节点 */\r\n\r\n/**\r\n * @brief 存储数据对齐方式\r\n */\r\n#define DB_ALIGNMENT 16\r\n#define db_align(d, a) (((d) + (a - 1)) & ~(a - 1))\r\n\r\n#define ceil(M) (((M)-1)/2)\r\n\r\n/**\r\n * @brief 数据块类型\r\n */\r\n#define TYPE_KEY 0\r\n#define TYPE_VALUE 1\r\n\r\n/**\r\n * @brief 创建数据库时,指定的key类型\r\n */\r\n#define DB_STRINGKEY 0 /** 4 <= max_key_size <= 128, include \'\\0\', 包含\'\\0\'在内 */\r\n#define DB_BYTESKEY 1 /** 4 <= max_key_size <= 128 */\r\n#define DB_INT32KEY 2 /** max_key_size = sizeof(int32_t) */\r\n#define DB_INT64KEY 3 /** max_key_size = sizeof(int64_t) */\r\n\r\ntypedef struct{\r\n off_t value;\r\n off_t child;\r\n unsigned char key[0];\r\n}btree_key;\r\n\r\ntypedef struct{\r\n size_t size;\r\n unsigned char value[0];\r\n}btree_value;\r\n\r\n/**\r\n * @brief 文件数据库的数据块的头\r\n */\r\ntypedef struct{\r\n off_t self; /** 数据块位置 */\r\n size_t num; /** 当前数据块作为btree_key时,表示btree节点的关键字数;当前数据块作为btree_value时,表示块的引用数 */\r\n off_t free; /** 空闲链表节点 */\r\n uint32_t use:1; /** 当前数据块是否被使用 */\r\n uint32_t type:1; /** 当前数据块作为btree_key或btree_value */\r\n uint32_t leaf:1; /** 当前数据块作为btree_key时,表示节点为叶子节点或非叶子节点 */\r\n uint32_t last:29; /** 当前数据块作为btree_value时,表示数据块未分配的空间 */\r\n}btree_node;\r\n\r\n#define btree_key_ptr(db,node,n) ((btree_key*)((char *)(node) + sizeof(*node) + (db->key_align) * (n)))\r\n#define btree_value_ptr(node,n) ((btree_value*)((char *)(node) + (n)))\r\n\r\n/**\r\n * @brief 文件数据库的头,即是句柄\r\n */\r\ntypedef struct db_s{\r\n int fd; /** 文件句柄 */\r\n int key_type; /** key类型,必须在创建文件数据库时指定 */\r\n size_t key_size; /** key的最大长度 */\r\n size_t key_align; /** 对齐,值 = db_align(sizeof(btree_key) + key_size, DB_ALIGNMENT) */\r\n size_t M; /** Btree 节点child的最大值 */\r\n size_t key_total; /** 已存储的key总数 */\r\n size_t key_use_block; /** 数据块为btree_key类型的总数 */\r\n size_t value_use_block; /** 数据块为btree_value类型的总数 */ \r\n off_t free; /** 空闲链表的头 */\r\n off_t current; /** 当前作为btree_value的数据块,未用完分配空间 */\r\n int (*key_cmp)(void*,void*,size_t); /** key比较方式 */\r\n}db_t;\r\n\r\nstatic int cmp_string(void *a, void *b, size_t n){\r\n return strncmp((char*)a, (char*)b, n);\r\n}\r\n\r\nstatic int cmp_bytes(void *a, void *b, size_t n){\r\n return memcmp(a, b, n);\r\n}\r\n\r\nstatic int cmp_int32(void *a, void *b, size_t n){\r\n return *(int32_t*)a - *(int32_t*)b;\r\n}\r\n\r\nstatic int cmp_int64(void *a, void *b, size_t n){\r\n return *(int64_t*)a - *(int64_t*)b;\r\n}\r\n\r\n/** \r\n * @brief 读出文件数据库的头,即是数据库句柄\r\n*/\r\ninline static ssize_t head_seek(db_t *db){\r\n int fd = db->fd;\r\n int (*key_cmp)(void*,void*,size_t) = db->key_cmp;\r\n ssize_t rc = pread(fd,db,DB_HEAD_SIZE,0);\r\n db->fd = fd;\r\n db->key_cmp = key_cmp;\r\n return rc;\r\n}\r\n\r\n/** \r\n * @brief 写入文件数据库的头,即是数据库句柄\r\n*/\r\ninline static ssize_t head_flush(db_t *db){\r\n return pwrite(db->fd,db,DB_HEAD_SIZE,0);\r\n}\r\n\r\n/** \r\n * @brief 读出文件数据库的数据块\r\n*/\r\ninline static ssize_t node_seek(db_t *db, btree_node* node, off_t offset){\r\n return pread(db->fd,node,DB_BLOCK_SIZE,offset);\r\n}\r\n\r\n/** \r\n *Line truncated
INSERT INTO `onefile` VALUES (6, 'threadpoll', 'C++', '一个简单的 C++11 线程池实现', 12, 'https://github.com/progschj/ThreadPool', 9000, '#ifndef THREAD_POOL_H\r\n#define THREAD_POOL_H\r\n\r\n#include <vector>\r\n#include <queue>\r\n#include <memory>\r\n#include <thread>\r\n#include <mutex>\r\n#include <condition_variable>\r\n#include <future>\r\n#include <functional>\r\n#include <stdexcept>\r\n\r\nclass ThreadPool {\r\npublic:\r\n ThreadPool(size_t);\r\n template<class F, class... Args>\r\n auto enqueue(F&& f, Args&&... args) \r\n -> std::future<typename std::result_of<F(Args...)>::type>;\r\n ~ThreadPool();\r\nprivate:\r\n // need to keep track of threads so we can join them\r\n std::vector< std::thread > workers;\r\n // the task queue\r\n std::queue< std::function<void()> > tasks;\r\n \r\n // synchronization\r\n std::mutex queue_mutex;\r\n std::condition_variable condition;\r\n bool stop;\r\n};\r\n \r\n// the constructor just launches some amount of workers\r\ninline ThreadPool::ThreadPool(size_t threads)\r\n : stop(false)\r\n{\r\n for(size_t i = 0;i<threads;++i)\r\n workers.emplace_back(\r\n [this]\r\n {\r\n for(;;)\r\n {\r\n std::function<void()> task;\r\n\r\n {\r\n std::unique_lock<std::mutex> lock(this->queue_mutex);\r\n this->condition.wait(lock,\r\n [this]{ return this->stop || !this->tasks.empty(); });\r\n if(this->stop && this->tasks.empty())\r\n return;\r\n task = std::move(this->tasks.front());\r\n this->tasks.pop();\r\n }\r\n\r\n task();\r\n }\r\n }\r\n );\r\n}\r\n\r\n// add new work item to the pool\r\ntemplate<class F, class... Args>\r\nauto ThreadPool::enqueue(F&& f, Args&&... args) \r\n -> std::future<typename std::result_of<F(Args...)>::type>\r\n{\r\n using return_type = typename std::result_of<F(Args...)>::type;\r\n\r\n auto task = std::make_shared< std::packaged_task<return_type()> >(\r\n std::bind(std::forward<F>(f), std::forward<Args>(args)...)\r\n );\r\n \r\n std::future<return_type> res = task->get_future();\r\n {\r\n std::unique_lock<std::mutex> lock(queue_mutex);\r\n\r\n // don\'t allow enqueueing after stopping the pool\r\n if(stop)\r\n throw std::runtime_error(\"enqueue on stopped ThreadPool\");\r\n\r\n tasks.emplace([task](){ (*task)(); });\r\n }\r\n condition.notify_one();\r\n return res;\r\n}\r\n\r\n// the destructor joins all threads\r\ninline ThreadPool::~ThreadPool()\r\n{\r\n {\r\n std::unique_lock<std::mutex> lock(queue_mutex);\r\n stop = true;\r\n }\r\n condition.notify_all();\r\n for(std::thread &worker: workers)\r\n worker.join();\r\n}\r\n\r\n#endif', 1);
INSERT INTO `onefile` VALUES (7, 'looptap', 'HTML', '消磨时间的小游戏,把球停在有颜色区域', 12, 'https://github.com/vasanthv/looptap', 5200, '<!DOCTYPE html>\r\n<html lang=\"zh\">\r\n\r\n<head>\r\n <meta charset=\"UTF-8\" />\r\n <meta name=\"author\" content=\"Vasanth.V\" />\r\n <meta name=\"theme-color\" content=\"#FFFFFF\" />\r\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"https://img.hellogithub.com/favicon/apple-touch-icon.png\">\r\n <link rel=\"android-chrome\" sizes=\"192x192\" href=\"https://img.hellogithub.com/favicon/android-chrome-192x192.png\">\r\n <link rel=\"android-chrome\" sizes=\"512x512\" href=\"https://img.hellogithub.com/favicon/android-chrome-512x512.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://img.hellogithub.com/favicon/favicon-32x32.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://img.hellogithub.com/favicon/favicon-16x16.png\">\r\n <link rel=\"icon\" href=\"https://img.hellogithub.com/favicon/favicon.ico\">\r\n \r\n <title>Looptap - 消磨时间的小游戏</title>\r\n <script src=\"https://cdn.staticfile.org/vue/2.2.2/vue.min.js\"></script>\r\n\r\n <style>\r\n html,\r\n body {\r\n overscroll-behavior: none;\r\n }\r\n\r\n body {\r\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Ubuntu, \"Helvetica Neue\", sans-serif;\r\n margin: 0;\r\n line-height: 1.5;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n -webkit-text-size-adjust: 100%;\r\n background: #fbf9f6;\r\n }\r\n\r\n a {\r\n color: inherit;\r\n }\r\n\r\n #canvas {\r\n display: none;\r\n height: 100vh;\r\n width: 100%;\r\n max-width: 640px;\r\n overflow: hidden;\r\n box-sizing: border-box;\r\n margin: auto;\r\n flex-direction: column;\r\n justify-content: center;\r\n }\r\n\r\n #canvas svg {\r\n width: 100%;\r\n }\r\n\r\n #about {\r\n text-align: center;\r\n font-size: 1.2rem;\r\n line-height: 1.75;\r\n padding: 0rem 2rem 1rem;\r\n color: #2c3d51;\r\n }\r\n\r\n #about a {\r\n font-weight: 500;\r\n font-style: italic;\r\n }\r\n\r\n #ball {\r\n transform: translateZ(0);\r\n animation: rot 2000ms infinite linear;\r\n animation-play-state: paused;\r\n }\r\n\r\n #ball.started {\r\n animation-play-state: running;\r\n }\r\n\r\n #play {\r\n cursor: pointer;\r\n }\r\n\r\n #finalscore,\r\n #best {\r\n font-size: 70%;\r\n fill: #34495e;\r\n }\r\n\r\n #best {\r\n font-style: italic;\r\n font-size: 50%;\r\n }\r\n\r\n #tip {\r\n font-weight: 300;\r\n font-size: 18%;\r\n font-style: italic;\r\n padding: 0.5rem 2rem 0rem;\r\n }\r\n\r\n #shareBtn {\r\n background: #1d9bf0;\r\n color: #fff;\r\n width: 150px;\r\n text-align: center;\r\n text-decoration: none;\r\n border-radius: 2rem;\r\n padding: 0.3rem 1.5rem;\r\n margin: 1rem auto 0px;\r\n font-size: 1.25rem;\r\n }\r\n\r\n #shareBtn.hide {\r\n visibility: hidden;\r\n }\r\n\r\n @keyframes rot {\r\n from {\r\n transform: rotate(0deg) translate(40%) rotate(0deg);\r\n }\r\n\r\n to {\r\n transform: rotate(360deg) translate(40%) rotate(-360deg);\r\n }\r\n }\r\n </style>\r\n\r\n</head>\r\n\r\n<body>\r\n <section id=\"canvas\" v-bind:style=\"\'display:flex;\'\">\r\n <svg id=\"looptap\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\">\r\n <rect id=\"bg\" x=\"0\" cy=\"0\" height=\"100\" width=\"100\" fill=\"none\" />\r\n <text x=\"50\" y=\"50\" dominant-baseline=\"middle\" text-anchor=\"middle\" class=\"score\" id=\"score\"\r\n v-if=\"state === \'started\'\" v-html=\"score\"></text>\r\n <text x=\"50\" y=\"32\" text-anchor=\"middle\" class=\"score\" id=\"finalscore\" v-if=\"state === \'stopped\'\"\r\n v-html=\"score\"></text>\r\n <text x=\"50\" y=\"70\" text-anchor=\"middle\" class=\"score\" id=\"best\" v-if=\"state === \'stopped\'\"\r\n v-html=\"\'Best: \'+best\"></text>\r\n <g id=\"tip\" v-if=\"state === \'init\'\">\r\n <text x=\"50\" y=\"68\" text-anchor=\"middle\" class=\"tip\">\r\n 点击 ▶️ 开始 / 点Line truncated
INSERT INTO `onefile` VALUES (8, 'minesweeper', 'HTML', '扫雷游戏', 12, 'https://github.com/521xueweihan/OneFile/blob/main/src/html/minesweeper.html', 3200, '<html>\r\n\r\n<head>\r\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"https://img.hellogithub.com/favicon/apple-touch-icon.png\">\r\n <link rel=\"android-chrome\" sizes=\"192x192\" href=\"https://img.hellogithub.com/favicon/android-chrome-192x192.png\">\r\n <link rel=\"android-chrome\" sizes=\"512x512\" href=\"https://img.hellogithub.com/favicon/android-chrome-512x512.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://img.hellogithub.com/favicon/favicon-32x32.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://img.hellogithub.com/favicon/favicon-16x16.png\">\r\n <link rel=\"icon\" href=\"https://img.hellogithub.com/favicon/favicon.ico\">\r\n \r\n <title>扫雷</title>\r\n <style type=\"text/css\">\r\n .minetbl {\r\n border: solid #008800 2px;\r\n cursor: crosshair;\r\n }\r\n\r\n body {\r\n background-color: #000000;\r\n color: #aaFFaa;\r\n }\r\n\r\n input {\r\n background-color: #330033;\r\n color: #aaFFaa;\r\n border: solid #00FF00 1px;\r\n text-align: center;\r\n }\r\n\r\n select {\r\n background-color: #330033;\r\n color: #aaFFaa;\r\n border: solid #00FF00 1px;\r\n text-align: center;\r\n }\r\n\r\n #headingBox {\r\n position: absolute;\r\n top: 8px;\r\n left: 8px;\r\n z-index: 100;\r\n width: auto;\r\n overflow: visible;\r\n }\r\n\r\n H1,\r\n H2 {\r\n margin: 0px;\r\n padding: 0px;\r\n }\r\n\r\n #face {\r\n border: none;\r\n text-decoration: none;\r\n color: #FFFF00;\r\n font-size: 52px;\r\n }\r\n\r\n #modeBox {\r\n position: absolute;\r\n border: solid green 1px;\r\n top: 0px;\r\n right: 0px;\r\n z-index: 101;\r\n padding-top: 8px;\r\n padding-right: 8px;\r\n padding-left: 8px;\r\n padding-bottom: 0px;\r\n }\r\n\r\n #modeBoxHandle {\r\n border: solid green 1px;\r\n text-align: center;\r\n -moz-border-radius: 10 10 0 0;\r\n }\r\n\r\n #modeBoxHandleText {\r\n color: #44ff44;\r\n text-decoration: none;\r\n }\r\n\r\n .minecell {\r\n height: 2EM;\r\n width: 2EM;\r\n text-align: center;\r\n font-size: 1.5EM;\r\n vertical-align: center;\r\n }\r\n </style>\r\n <script>\r\n var i, j, count; // Counter variables\r\n var firstMove = 1; // flag to indicate if the first move is made yet\r\n // Create the board\r\n\r\n var boardRows = 9; // these three variables represent the size of the board,\r\n var boardCols = 9; // and the number of mines found on it - once the auto-\r\n var boardMines = 10; // build feature (and multiple diff. lvls) are used, they\r\n // will determine how the board is built.\r\n var board = new Array(boardRows);\r\n var flags = new Array(boardRows);\r\n var clockFlag = \"nothing running\";\r\n var clockAt = 0;\r\n var minesLeft = boardMines; // the dynamic count\r\n var tilesLeft = boardRows * boardCols - minesLeft;\r\n var totalClicks = 0; // Tracking how many clicks used so far (right and left both)\r\n var totalSquares = 0; // Tracking how many squares have been opened\r\n var hitBlankOrMine = 0; // For tracking how many \"number\" squares are hit before the\r\n // first \"blank\" area opens up, or a mine is hit.\r\n\r\n var tiles = new Array(); // Default font set: Full Emoji Support\r\n tiles[0] = \"&nbsp;\"; // Blank Space\r\n tiles[1] = \"<span style=\'color:#0000FF\'>1</span>\";\r\n tiles[2] = \"<span style=\'color:#00FF00\'>2</span>\";\r\n tiles[3] = \"<span style=\'color:#FF0000\'>3</span>\";\r\n tiles[4] = \"<span style=\'color:#000088\'>4</span>\";\r\n tiles[5] = \"<span style=\'color:#008800\'>5</span>\";\r\n tiles[6] = \"<span style=\'color:#880000\'>6</span>\";\r\n tiles[7] = \"<span style=\'color:#008888\'>7</span>\";\r\n tiles[8] = \"<span style=\'color:#888800\'>8</span>\";\r\n tiles[9] = \"<span style=\'color:#008800\'> &#9971;</span>\"; // Planted Flag\r\n tiles[10] = \"<span style=\'color:#FFFF00\'>&#128165;</span>\"; // Exploded Mine\r\n tiles[11] = \"<span style=\'color:#FF0000\'>&#128711;</span>\"; // False Flag\r\n tiles[12] = \"<span style=\'color:#000000\'>&#128163;</spaLine truncated
INSERT INTO `onefile` VALUES (9, '2048', 'HTML', '2048 游戏', 12, 'https://github.com/521xueweihan/OneFile/blob/main/src/html/2048.html', 3100, '<!DOCTYPE html>\r\n<html>\r\n\r\n<head>\r\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"https://img.hellogithub.com/favicon/apple-touch-icon.png\">\r\n <link rel=\"android-chrome\" sizes=\"192x192\" href=\"https://img.hellogithub.com/favicon/android-chrome-192x192.png\">\r\n <link rel=\"android-chrome\" sizes=\"512x512\" href=\"https://img.hellogithub.com/favicon/android-chrome-512x512.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://img.hellogithub.com/favicon/favicon-32x32.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://img.hellogithub.com/favicon/favicon-16x16.png\">\r\n <link rel=\"icon\" href=\"https://img.hellogithub.com/favicon/favicon.ico\">\r\n \r\n <title> 2048-game </title>\r\n <meta charset=\"utf-8\" />\r\n <style media=\"screen\">\r\n #game {\r\n display: none;\r\n position: absolute;\r\n left: 0px;\r\n top: 0px;\r\n right: 0px;\r\n bottom: 0px;\r\n background-color: #9DA5C3;\r\n opacity: 0.5;\r\n z-index: 1;\r\n }\r\n\r\n .clear:after {\r\n content: \"\";\r\n display: table;\r\n clear: both;\r\n }\r\n\r\n .left {\r\n float: left;\r\n }\r\n\r\n .right {\r\n float: right;\r\n }\r\n\r\n .scoreShow {\r\n height: 50px;\r\n text-align: center;\r\n line-height: 50px;\r\n }\r\n\r\n .model {\r\n text-decoration: none;\r\n color: white;\r\n background-color: #bbada0;\r\n font-size: 36px;\r\n border-radius: 10px;\r\n }\r\n\r\n .head {\r\n width: 480px;\r\n height: 50px;\r\n margin: 0 auto;\r\n font-size: 25px;\r\n }\r\n\r\n #gridPanel {\r\n width: 480px;\r\n height: 480px;\r\n margin: 0 auto;\r\n background-color: #bbada0;\r\n border-radius: 10px;\r\n position: relative;\r\n z-index: 1;\r\n }\r\n\r\n .grid,\r\n .cell {\r\n width: 100px;\r\n height: 100px;\r\n border-radius: 6px;\r\n }\r\n\r\n .grid {\r\n background-color: #ccc0b3;\r\n float: left;\r\n margin: 16px 0 0 16px;\r\n }\r\n\r\n .cell {\r\n position: absolute;\r\n font-size: 60px;\r\n text-align: center;\r\n line-height: 100px;\r\n color: #fff;\r\n }\r\n\r\n .n2 {\r\n background-color: #eee3da\r\n }\r\n\r\n .n4 {\r\n background-color: #ede0c8\r\n }\r\n\r\n .n8 {\r\n background-color: #f2b179\r\n }\r\n\r\n .n16 {\r\n background-color: #f59563\r\n }\r\n\r\n .n32 {\r\n background-color: #f67c5f\r\n }\r\n\r\n .n64 {\r\n background-color: #f65e3b\r\n }\r\n\r\n .n128 {\r\n background-color: #edcf72\r\n }\r\n\r\n .n256 {\r\n background-color: #edcc61\r\n }\r\n\r\n .n512 {\r\n background-color: #9c0\r\n }\r\n\r\n .n1024 {\r\n background-color: #33b5e5\r\n }\r\n\r\n .n2048 {\r\n background-color: #09c\r\n }\r\n\r\n .n4096 {\r\n background-color: #a6c\r\n }\r\n\r\n .n8192 {\r\n background-color: #93c\r\n }\r\n\r\n .n2,\r\n .n4 {\r\n color: #776e65\r\n }\r\n\r\n #gameover {\r\n width: 100%;\r\n display: none;\r\n position: fixed;\r\n left: 50%;\r\n right: 50%;\r\n top: 148px;\r\n width: 220px;\r\n height: 200px;\r\n border-radius: 10px;\r\n background-color: white;\r\n margin-left: -110px;\r\n text-align: center;\r\n z-index: 5;\r\n }\r\n\r\n #gameover>a {\r\n display: inline-block;\r\n width: 170px;\r\n height: 50px;\r\n border-radius: 10px;\r\n text-decoration: none;\r\n background-color: #9F8D77;\r\n color: white;\r\n font-size: 36px;\r\n }\r\n </style>\r\n</head>\r\n\r\n<body>\r\n <div id=\"game\">\r\n </div>\r\n <div class=\"head clear\">\r\n <div class=\"scoreShow left\">\r\n <span>Score:</span>\r\n <span id=\"score\"></span>\r\n </div>\r\n <div class=\"selction right\" onclick=\"getModel(event)\">\r\n <a href=\"#\" class=\"model\" value=\"3\">3X3</a>\r\n <a href=\"#\" class=\"model\" value=\"4\">4X4</a>\r\n <a href=\"#\" class=\"model\" type=\"button\">5X5</a>\r\n <a href=\"#\" class=\"model\" type=\"button\">6X6</a>\r\n <!-- <input type=\"text\" id=\"model\"> -->\r\n <!-- <button type=\"button\" name=\"button\" id=\"set\">设置游戏</button> -->\r\n </div>\r\n </div>\r\n <div id=\"gridPanel\">\r\n </div>\r\n <div id=\"gameover\">\r\n <h1 id=\"Score\"></h1>\r\n <a href=\"#\" id=\"again\" onclick=\"obj.gameStart()\">Try again</a>\r\n </div>\r\n <script type=\"text/javascript\">\r\n var arr = [];\r\n\r\n function $(id) {\r\n return document.getElementById(id);\r\n }\r\n\r\n function C(Line truncated
INSERT INTO `onefile` VALUES (10, 'ascii-cam', 'HTML', '把视频图像转成 ascii \r\n', 12, 'https://github.com/521xueweihan/OneFile/blob/main/src/html/ascii-cam.html', 2600, '<!DOCTYPE html>\r\n<html lang=\"en\">\r\n\r\n<head>\r\n <meta charset=\"UTF-8\" />\r\n <meta name=\"author\" content=\"iveseenthedark\" />\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\r\n <meta name=\"theme-color\" content=\"#333333\" />\r\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"https://img.hellogithub.com/favicon/apple-touch-icon.png\">\r\n <link rel=\"android-chrome\" sizes=\"192x192\" href=\"https://img.hellogithub.com/favicon/android-chrome-192x192.png\">\r\n <link rel=\"android-chrome\" sizes=\"512x512\" href=\"https://img.hellogithub.com/favicon/android-chrome-512x512.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://img.hellogithub.com/favicon/favicon-32x32.png\">\r\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://img.hellogithub.com/favicon/favicon-16x16.png\">\r\n <link rel=\"icon\" href=\"https://img.hellogithub.com/favicon/favicon.ico\">\r\n \r\n <title>A S C I I C A M</title>\r\n <style>\r\n #ascii-cam pre,\r\n body,\r\n html {\r\n width: 100vw;\r\n height: 100vh;\r\n margin: 0;\r\n }\r\n\r\n * {\r\n box-sizing: border-box;\r\n }\r\n\r\n body {\r\n overflow: hidden;\r\n background-color: #000;\r\n color: #eee;\r\n font-family: monospace;\r\n }\r\n\r\n #logo,\r\n #enable-cam-msg {\r\n transform: translate(-50%, -50%);\r\n position: absolute;\r\n left: 50%;\r\n top: 50%;\r\n }\r\n\r\n .fade {\r\n transition: opacity 0.25s ease-in-out;\r\n }\r\n\r\n #logo {\r\n line-height: 1.5;\r\n }\r\n\r\n #ascii-cam {\r\n opacity: 0;\r\n }\r\n\r\n #ascii-cam pre {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n overflow: hidden;\r\n line-height: 0.6;\r\n user-select: none;\r\n mix-blend-mode: screen;\r\n font-size: 1.2em;\r\n font-size: 2vh;\r\n }\r\n\r\n @media (max-height: 50em) {\r\n #ascii-cam pre {\r\n font-size: 1em;\r\n }\r\n }\r\n\r\n @media (min-height: 60em) {\r\n #ascii-cam pre {\r\n font-size: 1.2em;\r\n }\r\n }\r\n\r\n #ascii-cam #r-output {\r\n color: red;\r\n }\r\n\r\n #ascii-cam #g-output {\r\n color: #0f0;\r\n }\r\n\r\n #ascii-cam #b-output {\r\n color: #00f;\r\n }\r\n\r\n #enable-cam-msg {\r\n opacity: 0;\r\n font-size: 3rem;\r\n background-color: white;\r\n color: black;\r\n margin: 0;\r\n max-width: 50vw;\r\n white-space: pre-line;\r\n text-align: center;\r\n font-weight: 900;\r\n }\r\n\r\n #canvas,\r\n #video {\r\n display: none;\r\n }\r\n </style>\r\n</head>\r\n\r\n<body>\r\n <pre id=\"logo\" class=\"fade\">\r\n\r\n _n_|_|_,_\r\n |===.-.===|\r\n | ((_)) |\r\n \'===\'-\'===\'\r\nA S C I I C A M\r\n点击“允许”使用摄像头\r\n </pre>\r\n\r\n <pre id=\"enable-cam-msg\" class=\"fade\">Allow access to camera to use</pre>\r\n\r\n <div id=\"ascii-cam\" class=\"fade\">\r\n <div class=\"layers\">\r\n <pre id=\"r-output\"></pre>\r\n <pre id=\"g-output\"></pre>\r\n <pre id=\"b-output\"></pre>\r\n </div>\r\n </div>\r\n\r\n <video id=\"video\" autoplay=\"true\"></video>\r\n <canvas id=\"canvas\" width=\"640\" height=\"480\"></canvas>\r\n <script type=\"application/javascript\">\r\n (() => {\r\n \'use strict\';\r\n\r\n let interval;\r\n let r_layer, g_layer, b_layer;\r\n const palette = [\' \', \'.\', \'-\', \':\', \'+\', \'*\', \'=\', \'%\', \'@\', \'#\'];\r\n const vanity = \'B Y I V E S E E N T H E D A R K\';\r\n\r\n /**\r\n * @param {*} stream\r\n */\r\n const handle_video = stream => {\r\n const canvas = document.getElementById(\'canvas\');\r\n const ctx = canvas.getContext(\'2d\');\r\n\r\n const video = document.getElementById(\'video\');\r\n // Older browsers may not have srcObject\r\n if (\'srcObject\' in video) {\r\n video.srcObject = stream;\r\n } else {\r\n // Avoid using this in new browsers, as it is going away.\r\n video.srLine truncated
INSERT INTO `onefile` VALUES (11, 'the-super-tiny-compiler', 'JavaScript', '人人都能看懂的微型编译器', 12, 'https://github.com/jamiebuilds/the-super-tiny-compiler', 9100, '\'use strict\';\r\n\r\n/**\r\n * TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE\r\n * T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E\r\n * T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E\r\n * T:::::TT:::::::TT:::::THH::::::H H::::::HHEE::::::EEEEEEEEE::::E\r\n * TTTTTT T:::::T TTTTTT H:::::H H:::::H E:::::E EEEEEE\r\n * T:::::T H:::::H H:::::H E:::::E\r\n * T:::::T H::::::HHHHH::::::H E::::::EEEEEEEEEE\r\n * T:::::T H:::::::::::::::::H E:::::::::::::::E\r\n * T:::::T H:::::::::::::::::H E:::::::::::::::E\r\n * T:::::T H::::::HHHHH::::::H E::::::EEEEEEEEEE\r\n * T:::::T H:::::H H:::::H E:::::E\r\n * T:::::T H:::::H H:::::H E:::::E EEEEEE\r\n * TT:::::::TT HH::::::H H::::::HHEE::::::EEEEEEEE:::::E\r\n * T:::::::::T H:::::::H H:::::::HE::::::::::::::::::::E\r\n * T:::::::::T H:::::::H H:::::::HE::::::::::::::::::::E\r\n * TTTTTTTTTTT HHHHHHHHH HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE\r\n *\r\n * SSSSSSSSSSSSSSS UUUUUUUU UUUUUUUUPPPPPPPPPPPPPPPPP EEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRR\r\n * SS:::::::::::::::SU::::::U U::::::UP::::::::::::::::P E::::::::::::::::::::ER::::::::::::::::R\r\n * S:::::SSSSSS::::::SU::::::U U::::::UP::::::PPPPPP:::::P E::::::::::::::::::::ER::::::RRRRRR:::::R\r\n * S:::::S SSSSSSSUU:::::U U:::::UUPP:::::P P:::::PEE::::::EEEEEEEEE::::ERR:::::R R:::::R\r\n * S:::::S U:::::U U:::::U P::::P P:::::P E:::::E EEEEEE R::::R R:::::R\r\n * S:::::S U:::::U U:::::U P::::P P:::::P E:::::E R::::R R:::::R\r\n * S::::SSSS U:::::U U:::::U P::::PPPPPP:::::P E::::::EEEEEEEEEE R::::RRRRRR:::::R\r\n * SS::::::SSSSS U:::::U U:::::U P:::::::::::::PP E:::::::::::::::E R:::::::::::::RR\r\n * SSS::::::::SS U:::::U U:::::U P::::PPPPPPPPP E:::::::::::::::E R::::RRRRRR:::::R\r\n * SSSSSS::::S U:::::U U:::::U P::::P E::::::EEEEEEEEEE R::::R R:::::R\r\n * S:::::S U:::::U U:::::U P::::P E:::::E R::::R R:::::R\r\n * S:::::S U::::::U U::::::U P::::P E:::::E EEEEEE R::::R R:::::R\r\n * SSSSSSS S:::::S U:::::::UUU:::::::U PP::::::PP EE::::::EEEEEEEE:::::ERR:::::R R:::::R\r\n * S::::::SSSSSS:::::S UU:::::::::::::UU P::::::::P E::::::::::::::::::::ER::::::R R:::::R\r\n * S:::::::::::::::SS UU:::::::::UU P::::::::P E::::::::::::::::::::ER::::::R R:::::R\r\n * SSSSSSSSSSSSSSS UUUUUUUUU PPPPPPPPPP EEEEEEEEEEEEEEEEEEEEEERRRRRRRR RRRRRRR\r\n *\r\n * TTTTTTTTTTTTTTTTTTTTTTTIIIIIIIIIINNNNNNNN NNNNNNNNYYYYYYY YYYYYYY\r\n * T:::::::::::::::::::::TI::::::::IN:::::::N N::::::NY:::::Y Y:::::Y\r\n * T:::::::::::::::::::::TI::::::::IN::::::::N N::::::NY:::::Y Y:::::Y\r\n * T:::::TT:::::::TT:::::TII::::::IIN:::::::::N N::::::NY::::::Y Y::::::Y\r\n * TTTTTT T:::::T TTTTTT I::::I N::::::::::N N::::::NYYY:::::Y Y:::::YYY\r\n * T:::::T I::::I N:::::::::::N N::::::N Y:::::Y Y:::::Y\r\n * T:::::T I::::I N:::::::N::::N N::::::N Y:::::Y:::::Y\r\n * T:::::T I::::I N::::::N N::::N N::::::N Y:::::::::Y\r\n * T:::::T I::::I N::::::N N::::N:::::::N Y:::::::Y\r\n * T:::::T I::::I N::::::N N:::::::::::N Y:::::Y\r\n * T:::::T I::::I N::::::N N::::::::::N Y:::::Y\r\n * T:::::T I::::I N::::::N N:::::::::N Y:::::Y\r\n * TT:::::::TT II::::::IIN::::::N N::::::::N Y:::::Y\r\n * T:::::::::T I::::::::IN::::::N N:::::::N YYYY:::::YYYY\r\n * T:::::::::T I::::::::IN::::::N N::::::N Y:::::::::::Y\r\n * TTTTTTTTTTT IIIIIIIIIINNNNNNNN NNNNNNN YYYYYYYYYYYYY\r\n *\r\n * CCCCCCCCCCCCC OOOOOOOOO MMMMMMMM MMMMMMMMPPPPPPPPPPPPPPPPP IIIIIIIIIILLLLLLLLLLL EEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRR\r\n * CCC::::::::::::C OO:::::::::OO M:::::::M M:::::::MP::::::::::::::::P I::::::::IL:::::::::L E::::::::::::::::::::ER::::::::::::::::R\r\n * CC:::::::::::::::C OO:::::::::::::OO M::::::::M M::::::::MP::::::PPPPPP:::::P I::::::::IL:::::::::L E::::::::::::::::::::ER::::::RRRRRR:::::R\r\n * C:::::CCCCCCCC::::CO:::::::OOO:::::::OM:::::::::Line truncated
INSERT INTO `onefile` VALUES (12, 'pico', 'JavaScript', '200 行实现的面部识别库', 12, 'https://github.com/nenadmarkus/picojs', 1100, '/* This library is released under the MIT license, see https://github.com/nenadmarkus/picojs */\r\npico = {}\r\n\r\npico.unpack_cascade = function(bytes)\r\n{\r\n //\r\n const dview = new DataView(new ArrayBuffer(4));\r\n /*\r\n we skip the first 8 bytes of the cascade file\r\n (cascade version number and some data used during the learning process)\r\n */\r\n let p = 8;\r\n /*\r\n read the depth (size) of each tree first: a 32-bit signed integer\r\n */\r\n dview.setUint8(0, bytes[p+0]), dview.setUint8(1, bytes[p+1]), dview.setUint8(2, bytes[p+2]), dview.setUint8(3, bytes[p+3]);\r\n const tdepth = dview.getInt32(0, true);\r\n p = p + 4\r\n /*\r\n next, read the number of trees in the cascade: another 32-bit signed integer\r\n */\r\n dview.setUint8(0, bytes[p+0]), dview.setUint8(1, bytes[p+1]), dview.setUint8(2, bytes[p+2]), dview.setUint8(3, bytes[p+3]);\r\n const ntrees = dview.getInt32(0, true);\r\n p = p + 4\r\n /*\r\n read the actual trees and cascade thresholds\r\n */\r\n const tcodes_ls = [];\r\n const tpreds_ls = [];\r\n const thresh_ls = [];\r\n for(let t=0; t<ntrees; ++t)\r\n {\r\n // read the binary tests placed in internal tree nodes\r\n Array.prototype.push.apply(tcodes_ls, [0, 0, 0, 0]);\r\n Array.prototype.push.apply(tcodes_ls, bytes.slice(p, p+4*Math.pow(2, tdepth)-4));\r\n p = p + 4*Math.pow(2, tdepth)-4;\r\n // read the prediction in the leaf nodes of the tree\r\n for(let i=0; i<Math.pow(2, tdepth); ++i)\r\n {\r\n dview.setUint8(0, bytes[p+0]), dview.setUint8(1, bytes[p+1]), dview.setUint8(2, bytes[p+2]), dview.setUint8(3, bytes[p+3]);\r\n tpreds_ls.push(dview.getFloat32(0, true));\r\n p = p + 4;\r\n }\r\n // read the threshold\r\n dview.setUint8(0, bytes[p+0]), dview.setUint8(1, bytes[p+1]), dview.setUint8(2, bytes[p+2]), dview.setUint8(3, bytes[p+3]);\r\n thresh_ls.push(dview.getFloat32(0, true));\r\n p = p + 4;\r\n }\r\n const tcodes = new Int8Array(tcodes_ls);\r\n const tpreds = new Float32Array(tpreds_ls);\r\n const thresh = new Float32Array(thresh_ls);\r\n /*\r\n construct the classification function from the read data\r\n */\r\n function classify_region(r, c, s, pixels, ldim)\r\n {\r\n r = 256*r;\r\n c = 256*c;\r\n let root = 0;\r\n let o = 0.0;\r\n const pow2tdepth = Math.pow(2, tdepth) >> 0; // \'>>0\' transforms this number to int\r\n\r\n for(let i=0; i<ntrees; ++i)\r\n {\r\n let idx = 1;\r\n for(let j=0; j<tdepth; ++j)\r\n // we use \'>> 8\' here to perform an integer division: this seems important for performance\r\n idx = 2*idx + (pixels[((r+tcodes[root + 4*idx + 0]*s) >> 8)*ldim+((c+tcodes[root + 4*idx + 1]*s) >> 8)]<=pixels[((r+tcodes[root + 4*idx + 2]*s) >> 8)*ldim+((c+tcodes[root + 4*idx + 3]*s) >> 8)]);\r\n\r\n o = o + tpreds[pow2tdepth*i + idx-pow2tdepth];\r\n\r\n if(o<=thresh[i])\r\n return -1;\r\n\r\n root += 4*pow2tdepth;\r\n }\r\n return o - thresh[ntrees-1];\r\n }\r\n /*\r\n we\'re done\r\n */\r\n return classify_region;\r\n}\r\n\r\npico.run_cascade = function(image, classify_region, params)\r\n{\r\n const pixels = image.pixels;\r\n const nrows = image.nrows;\r\n const ncols = image.ncols;\r\n const ldim = image.ldim;\r\n\r\n const shiftfactor = params.shiftfactor;\r\n const minsize = params.minsize;\r\n const maxsize = params.maxsize;\r\n const scalefactor = params.scalefactor;\r\n\r\n let scale = minsize;\r\n const detections = [];\r\n\r\n while(scale<=maxsize)\r\n {\r\n const step = Math.max(shiftfactor*scale, 1) >> 0; // \'>>0\' transforms this number to int\r\n const offset = (scale/2 + 1) >> 0;\r\n\r\n for(let r=offset; r<=nrows-offset; r+=step)\r\n for(let c=offset; c<=ncols-offset; c+=step)\r\n {\r\n const q = classify_region(r, c, scale, pixels, ldim);\r\n if (q > 0.0)\r\n detections.push([r, c, scale, q]);\r\n }\r\n \r\n scale = scale*scalefactor;\r\n }\r\n\r\n return detections;\r\n}\r\n\r\npico.cluster_detections = function(dets, iouthreshold)\r\n{\r\n /*\r\n sort detections by their score\r\n */\r\n dets = dets.sort(function(a, b) {\r\n return b[3] - a[3];\r\n });\r\n /*\r\n this helper function calculates the intersection over union for two detections\r\n */\r\n function calculate_iou(det1, det2)\r\n {\r\n // unpack the position and size of each detection\r\n const r1=det1[0], c1=det1[1], s1=det1[2];\r\n const r2=det2[0], c2=det2[1], s2=det2[2];\r\n // calculate detection overlap in each dimension\r\n const overr = Math.max(0, Math.min(r1+s1/2, r2+s2/2) - Math.max(r1-s1/2, r2-s2/2));\r\n const overc = Math.max(0, Math.min(c1+s1/2, c2+s2/2) - Math.max(c1-s1/2, c2-s2/2));\r\n // calculate and return IoU\r\n return overr*overc/(s1*s1+s2*s2-overr*overc);\r\n }\r\n /*\r\n do clustering through non-maximum suppression\r\n */\r\n const assignments = new Array(dets.length).fill(0);\r\n const clusters = [];\r\n for(let i=0;Line truncated
INSERT INTO `onefile` VALUES (13, 'parsedown', 'PHP', '一个小而美的 PHP 的 Markdown 解析库', 12, 'https://github.com/erusev/parsedown', 7700, '<?php\r\n\r\n#\r\n#\r\n# Parsedown\r\n# http://parsedown.org\r\n#\r\n# (c) Emanuil Rusev\r\n# http://erusev.com\r\n#\r\n# For the full license information, view the LICENSE file that was distributed\r\n# with this source code.\r\n#\r\n#\r\n\r\nclass Parsedown\r\n{\r\n # ~\r\n\r\n const version = \'1.8.0-beta-7\';\r\n\r\n # ~\r\n\r\n function text($text)\r\n {\r\n $Elements = $this->textElements($text);\r\n\r\n # convert to markup\r\n $markup = $this->elements($Elements);\r\n\r\n # trim line breaks\r\n $markup = trim($markup, \"\\n\");\r\n\r\n return $markup;\r\n }\r\n\r\n protected function textElements($text)\r\n {\r\n # make sure no definitions are set\r\n $this->DefinitionData = array();\r\n\r\n # standardize line breaks\r\n $text = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $text);\r\n\r\n # remove surrounding line breaks\r\n $text = trim($text, \"\\n\");\r\n\r\n # split text into lines\r\n $lines = explode(\"\\n\", $text);\r\n\r\n # iterate through lines to identify blocks\r\n return $this->linesElements($lines);\r\n }\r\n\r\n #\r\n # Setters\r\n #\r\n\r\n function setBreaksEnabled($breaksEnabled)\r\n {\r\n $this->breaksEnabled = $breaksEnabled;\r\n\r\n return $this;\r\n }\r\n\r\n protected $breaksEnabled;\r\n\r\n function setMarkupEscaped($markupEscaped)\r\n {\r\n $this->markupEscaped = $markupEscaped;\r\n\r\n return $this;\r\n }\r\n\r\n protected $markupEscaped;\r\n\r\n function setUrlsLinked($urlsLinked)\r\n {\r\n $this->urlsLinked = $urlsLinked;\r\n\r\n return $this;\r\n }\r\n\r\n protected $urlsLinked = true;\r\n\r\n function setSafeMode($safeMode)\r\n {\r\n $this->safeMode = (bool) $safeMode;\r\n\r\n return $this;\r\n }\r\n\r\n protected $safeMode;\r\n\r\n function setStrictMode($strictMode)\r\n {\r\n $this->strictMode = (bool) $strictMode;\r\n\r\n return $this;\r\n }\r\n\r\n protected $strictMode;\r\n\r\n protected $safeLinksWhitelist = array(\r\n \'http://\',\r\n \'https://\',\r\n \'ftp://\',\r\n \'ftps://\',\r\n \'mailto:\',\r\n \'tel:\',\r\n \'data:image/png;base64,\',\r\n \'data:image/gif;base64,\',\r\n \'data:image/jpeg;base64,\',\r\n \'irc:\',\r\n \'ircs:\',\r\n \'git:\',\r\n \'ssh:\',\r\n \'news:\',\r\n \'steam:\',\r\n );\r\n\r\n #\r\n # Lines\r\n #\r\n\r\n protected $BlockTypes = array(\r\n \'#\' => array(\'Header\'),\r\n \'*\' => array(\'Rule\', \'List\'),\r\n \'+\' => array(\'List\'),\r\n \'-\' => array(\'SetextHeader\', \'Table\', \'Rule\', \'List\'),\r\n \'0\' => array(\'List\'),\r\n \'1\' => array(\'List\'),\r\n \'2\' => array(\'List\'),\r\n \'3\' => array(\'List\'),\r\n \'4\' => array(\'List\'),\r\n \'5\' => array(\'List\'),\r\n \'6\' => array(\'List\'),\r\n \'7\' => array(\'List\'),\r\n \'8\' => array(\'List\'),\r\n \'9\' => array(\'List\'),\r\n \':\' => array(\'Table\'),\r\n \'<\' => array(\'Comment\', \'Markup\'),\r\n \'=\' => array(\'SetextHeader\'),\r\n \'>\' => array(\'Quote\'),\r\n \'[\' => array(\'Reference\'),\r\n \'_\' => array(\'Rule\'),\r\n \'`\' => array(\'FencedCode\'),\r\n \'|\' => array(\'Table\'),\r\n \'~\' => array(\'FencedCode\'),\r\n );\r\n\r\n # ~\r\n\r\n protected $unmarkedBlockTypes = array(\r\n \'Code\',\r\n );\r\n\r\n #\r\n # Blocks\r\n #\r\n\r\n protected function lines(array $lines)\r\n {\r\n return $this->elements($this->linesElements($lines));\r\n }\r\n\r\n protected function linesElements(array $lines)\r\n {\r\n $Elements = array();\r\n $CurrentBlock = null;\r\n\r\n foreach ($lines as $line)\r\n {\r\n if (chop($line) === \'\')\r\n {\r\n if (isset($CurrentBlock))\r\n {\r\n $CurrentBlock[\'interrupted\'] = (isset($CurrentBlock[\'interrupted\'])\r\n ? $CurrentBlock[\'interrupted\'] + 1 : 1\r\n );\r\n }\r\n\r\n continue;\r\n }\r\n\r\n while (($beforeTab = strstr($line, \"\\t\", true)) !== false)\r\n {\r\n $shortage = 4 - mb_strlen($beforeTab, \'utf-8\') % 4;\r\n\r\n $line = $beforeTab\r\n . str_repeat(\' \', $shortage)\r\n . substr($line, strlen($beforeTab) + 1)\r\n ;\r\n }\r\n\r\n $indent = strsLine truncated
INSERT INTO `onefile` VALUES (14, 'httpstat', 'Python', '用更优雅的方式展示 curl 结果的命令行工具', 12, 'https://github.com/reorx/httpstat', 8000, '#!/usr/bin/env python\r\n# coding: utf-8\r\n# References:\r\n# man curl\r\n# https://curl.haxx.se/libcurl/c/curl_easy_getinfo.html\r\n# https://curl.haxx.se/libcurl/c/easy_getinfo_options.html\r\n# http://blog.kenweiner.com/2014/11/http-request-timings-with-curl.html\r\n\r\nfrom __future__ import print_function\r\n\r\nimport os\r\nimport json\r\nimport sys\r\nimport logging\r\nimport tempfile\r\nimport subprocess\r\n\r\n\r\n__version__ = \'1.3.1\'\r\n\r\n\r\nPY3 = sys.version_info >= (3,)\r\n\r\nif PY3:\r\n xrange = range\r\n\r\n\r\n# Env class is copied from https://github.com/reorx/getenv/blob/master/getenv.py\r\nclass Env(object):\r\n prefix = \'HTTPSTAT\'\r\n _instances = []\r\n\r\n def __init__(self, key):\r\n self.key = key.format(prefix=self.prefix)\r\n Env._instances.append(self)\r\n\r\n def get(self, default=None):\r\n return os.environ.get(self.key, default)\r\n\r\n\r\nENV_SHOW_BODY = Env(\'{prefix}_SHOW_BODY\')\r\nENV_SHOW_IP = Env(\'{prefix}_SHOW_IP\')\r\nENV_SHOW_SPEED = Env(\'{prefix}_SHOW_SPEED\')\r\nENV_SAVE_BODY = Env(\'{prefix}_SAVE_BODY\')\r\nENV_CURL_BIN = Env(\'{prefix}_CURL_BIN\')\r\nENV_METRICS_ONLY = Env(\'{prefix}_METRICS_ONLY\')\r\nENV_DEBUG = Env(\'{prefix}_DEBUG\')\r\n\r\n\r\ncurl_format = \"\"\"{\r\n\"time_namelookup\": %{time_namelookup},\r\n\"time_connect\": %{time_connect},\r\n\"time_appconnect\": %{time_appconnect},\r\n\"time_pretransfer\": %{time_pretransfer},\r\n\"time_redirect\": %{time_redirect},\r\n\"time_starttransfer\": %{time_starttransfer},\r\n\"time_total\": %{time_total},\r\n\"speed_download\": %{speed_download},\r\n\"speed_upload\": %{speed_upload},\r\n\"remote_ip\": \"%{remote_ip}\",\r\n\"remote_port\": \"%{remote_port}\",\r\n\"local_ip\": \"%{local_ip}\",\r\n\"local_port\": \"%{local_port}\"\r\n}\"\"\"\r\n\r\nhttps_template = \"\"\"\r\n DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer\r\n[ {a0000} | {a0001} | {a0002} | {a0003} | {a0004} ]\r\n | | | | |\r\n namelookup:{b0000} | | | |\r\n connect:{b0001} | | |\r\n pretransfer:{b0002} | |\r\n starttransfer:{b0003} |\r\n total:{b0004}\r\n\"\"\"[1:]\r\n\r\nhttp_template = \"\"\"\r\n DNS Lookup TCP Connection Server Processing Content Transfer\r\n[ {a0000} | {a0001} | {a0003} | {a0004} ]\r\n | | | |\r\n namelookup:{b0000} | | |\r\n connect:{b0001} | |\r\n starttransfer:{b0003} |\r\n total:{b0004}\r\n\"\"\"[1:]\r\n\r\n\r\n# Color code is copied from https://github.com/reorx/python-terminal-color/blob/master/color_simple.py\r\nISATTY = sys.stdout.isatty()\r\n\r\n\r\ndef make_color(code):\r\n def color_func(s):\r\n if not ISATTY:\r\n return s\r\n tpl = \'\\x1b[{}m{}\\x1b[0m\'\r\n return tpl.format(code, s)\r\n return color_func\r\n\r\n\r\nred = make_color(31)\r\ngreen = make_color(32)\r\nyellow = make_color(33)\r\nblue = make_color(34)\r\nmagenta = make_color(35)\r\ncyan = make_color(36)\r\n\r\nbold = make_color(1)\r\nunderline = make_color(4)\r\n\r\ngrayscale = {(i - 232): make_color(\'38;5;\' + str(i)) for i in xrange(232, 256)}\r\n\r\n\r\ndef quit(s, code=0):\r\n if s is not None:\r\n print(s)\r\n sys.exit(code)\r\n\r\n\r\ndef print_help():\r\n help = \"\"\"\r\nUsage: httpstat URL [CURL_OPTIONS]\r\n httpstat -h | --help\r\n httpstat --version\r\n\r\nArguments:\r\n URL url to request, could be with or without `http(s)://` prefix\r\n\r\nOptions:\r\n CURL_OPTIONS any curl supported options, except for -w -D -o -S -s,\r\n which are already used internally.\r\n -h --help show this screen.\r\n --version show version.\r\n\r\nEnvironments:\r\n HTTPSTAT_SHOW_BODY Set to `true` to show response body in the output,\r\n note that body length is limited to 1023 bytes, will be\r\n truncated if exceeds. Default is `false`.\r\n HTTPSTAT_SHOW_IP By default httpstat shows remote and local IP/port address.\r\n Set to `false` to disable this feature. Default is `true`.\r\n HTTPSTAT_SHOW_SPEED Set to `Line truncated
INSERT INTO `onefile` VALUES (15, 'py2sec', 'Python', '一款轻量级跨平台 Python “加密”、加速的脚本工具', 12, 'https://github.com/cckuailong/py2sec', 8600, '# -*- coding: utf-8 -*-\r\nimport getopt\r\nimport os\r\nimport platform\r\nimport shutil\r\nimport subprocess\r\nimport sys\r\n\r\n\r\nclass OptionsOfBuild():\r\n def __init__(self):\r\n self.pyVer = \'\'\r\n self.fileName = \'\'\r\n self.rootName = \'\'\r\n self.excludeFiles = []\r\n self.nthread = \'1\'\r\n self.quiet = \"False\"\r\n self.release = False\r\n\r\n\r\nisWindows = True if platform.system() == \'Windows\' else False\r\n\r\npy2sec_version = (\'0\', \'3\', \'1\')\r\n\r\nHELP_TEXT = \'\'\'\r\npy2sec is a Cross-Platform, Fast and Flexible tool to compile the .py to .so(Linux and Mac) or .pdy(Win).\r\nYou can use it to hide the source code of py\r\nIt can be called by the main func as \"from module import * \"\r\npy2sec can be used in the environment of python2 or python3\r\n\r\nUsage: python py2sec.py [options] ...\r\n\r\nOptions:\r\n -v, --version Show the version of the py2sec\r\n -h, --help Show the help info\r\n -p, --python Python version, default is based on the version of python you bind with command \"python\" \r\n Example: -p 3 (means you tends to encrypt python3)\r\n -d, --directory Directory of your project (if use -d, you encrypt the whole directory)\r\n -f, --file File to be transfered (if use -f, you only encrypt one file)\r\n -m, --maintain List the file or the directory you don\'t want to transfer\r\n Note: The directories should be suffix by path separate char (\'\\\\\' in Windows or \'/\'), \r\n and must be the relative path to -d\'s value\r\n Example: -m setup.py,mod/__init__.py,exclude_dir/\r\n -x, --nthread number of parallel thread to build jobs\r\n -q --quiet Quiet Mode, Default: False\r\n -r --release Release Mode, clear all the tmp files, only output the result, Default: False\r\n\r\n\r\nExample:\r\n python py2sec.py -f test.py\r\n python py2sec.py -f example/test1.py -r\r\n python py2sec.py -d example/ -m test1.py,bbb/\r\n\r\n # some OS use command \"python3\" to run python3, like Ubuntu, you can use -p to solve it\r\n python3 py2sec.py -p 3 -d example/\r\n\'\'\'\r\n\r\nbuildingScript_fileName = \'tmp_py2sec_build.py\'\r\nbuildingScript_template_fileName = \'py2sec_build.py.template\'\r\n\r\n\r\ndef getFiles_inDir(dir_path,\r\n includeSubfolder=True,\r\n path_type=0,\r\n ext_names=\"*\"):\r\n \'\'\'获得指定目录下的所有文件,\r\n :param dir_path: 指定的目录路径\r\n :param includeSubfolder: 是否包含子文件夹里的文件,默认 True\r\n :param path_type: 返回的文件路径形式\r\n 0 绝对路径,默认值\r\n 1 相对路径\r\n 2 文件名\r\n :param ext_names: \"*\" | string | list\r\n 可以指定文件扩展名类型,支持以列表形式指定多个扩展名。默认为 \"*\",即所有扩展名。\r\n 举例:\".txt\" 或 [\".jpg\",\".png\"]\r\n\r\n :return: 以 yield 方式返回结果\r\n\r\n Updated:\r\n 2020-04-21\r\n Author:\r\n nodewee (https://nodewee.github.io)\r\n \'\'\'\r\n\r\n # ext_names\r\n if type(ext_names) is str:\r\n if ext_names != \"*\":\r\n ext_names = [ext_names]\r\n # lower ext name letters\r\n if type(ext_names) is list:\r\n for i in range(len(ext_names)):\r\n ext_names[i] = ext_names[i].lower()\r\n\r\n def willKeep_thisFile_by_ExtName(file_name):\r\n if type(ext_names) is list:\r\n if file_name[0] == \'.\':\r\n file_ext = file_name\r\n else:\r\n file_ext = os.path.splitext(file_name)[1]\r\n #\r\n if file_ext.lower() not in ext_names:\r\n return False\r\n else:\r\n return True\r\n return True\r\n\r\n if includeSubfolder:\r\n len_of_inpath = len(dir_path)\r\n for root, dirs, files in os.walk(dir_path):\r\n for file_name in files:\r\n if not willKeep_thisFile_by_ExtName(file_name):\r\n continue\r\n if path_type == 0: # absolute path\r\n yield os.path.join(root, file_name)\r\n elif path_type == 1: # relative path\r\n yield os.path.join(\r\n root[len_of_inpath:].lstrip(os.path.sep), file_name)\r\n else: # filen ame\r\n yield file_name\r\n else:\r\n for file_name in os.listdir(dir_path):\r\n filepath = os.path.join(dir_path, file_name)\r\n if os.path.isfile(filepath):\r\n #\r\n Line truncated
INSERT INTO `onefile` VALUES (16, 'tomato-clock', 'Python', 'Python 写的命令行番茄工作法定时器', 12, 'https://github.com/coolcode/tomato-clock', 8400, '#!/usr/bin/env python3\r\n# -*- coding: utf-8 -*-\r\n\r\n# Pomodoro 番茄工作法 https://en.wikipedia.org/wiki/Pomodoro_Technique\r\n# ====== 🍅 Tomato Clock =======\r\n# ./tomato.py # start a 25 minutes tomato clock + 5 minutes break\r\n# ./tomato.py -t # start a 25 minutes tomato clock\r\n# ./tomato.py -t <n> # start a <n> minutes tomato clock\r\n# ./tomato.py -b # take a 5 minutes break\r\n# ./tomato.py -b <n> # take a <n> minutes break\r\n# ./tomato.py -h # help\r\n\r\n\r\nimport sys\r\nimport time\r\nimport subprocess\r\n\r\nWORK_MINUTES = 25\r\nBREAK_MINUTES = 5\r\n\r\n\r\ndef main():\r\n try:\r\n if len(sys.argv) <= 1:\r\n print(f\'🍅 tomato {WORK_MINUTES} minutes. Ctrl+C to exit\')\r\n tomato(WORK_MINUTES, \'It is time to take a break\')\r\n print(f\'🛀 break {BREAK_MINUTES} minutes. Ctrl+C to exit\')\r\n tomato(BREAK_MINUTES, \'It is time to work\')\r\n\r\n elif sys.argv[1] == \'-t\':\r\n minutes = int(sys.argv[2]) if len(sys.argv) > 2 else WORK_MINUTES\r\n print(f\'🍅 tomato {minutes} minutes. Ctrl+C to exit\')\r\n tomato(minutes, \'It is time to take a break\')\r\n\r\n elif sys.argv[1] == \'-b\':\r\n minutes = int(sys.argv[2]) if len(sys.argv) > 2 else BREAK_MINUTES\r\n print(f\'🛀 break {minutes} minutes. Ctrl+C to exit\')\r\n tomato(minutes, \'It is time to work\')\r\n\r\n elif sys.argv[1] == \'-h\':\r\n help()\r\n\r\n else:\r\n help()\r\n\r\n except KeyboardInterrupt:\r\n print(\'\\n👋 goodbye\')\r\n except Exception as ex:\r\n print(ex)\r\n exit(1)\r\n\r\n\r\ndef tomato(minutes, notify_msg):\r\n start_time = time.perf_counter()\r\n while True:\r\n diff_seconds = int(round(time.perf_counter() - start_time))\r\n left_seconds = minutes * 60 - diff_seconds\r\n if left_seconds <= 0:\r\n print(\'\')\r\n break\r\n\r\n countdown = \'{}:{} ⏰\'.format(int(left_seconds / 60), int(left_seconds % 60))\r\n duration = min(minutes, 25)\r\n progressbar(diff_seconds, minutes * 60, duration, countdown)\r\n time.sleep(1)\r\n\r\n notify_me(notify_msg)\r\n\r\n\r\ndef progressbar(curr, total, duration=10, extra=\'\'):\r\n frac = curr / total\r\n filled = round(frac * duration)\r\n print(\'\\r\', \'🍅\' * filled + \'--\' * (duration - filled), \'[{:.0%}]\'.format(frac), extra, end=\'\')\r\n\r\n\r\ndef notify_me(msg):\r\n \'\'\'\r\n # macos desktop notification\r\n terminal-notifier -> https://github.com/julienXX/terminal-notifier#download\r\n terminal-notifier -message <msg>\r\n\r\n # ubuntu desktop notification\r\n notify-send\r\n\r\n # voice notification\r\n say -v <lang> <msg>\r\n lang options:\r\n - Daniel: British English\r\n - Ting-Ting: Mandarin\r\n - Sin-ji: Cantonese\r\n \'\'\'\r\n\r\n print(msg)\r\n try:\r\n if sys.platform == \'darwin\':\r\n # macos desktop notification\r\n subprocess.run([\'terminal-notifier\', \'-title\', \'🍅\', \'-message\', msg])\r\n subprocess.run([\'say\', \'-v\', \'Daniel\', msg])\r\n elif sys.platform.startswith(\'linux\'):\r\n # ubuntu desktop notification\r\n subprocess.Popen([\"notify-send\", \'🍅\', msg])\r\n else:\r\n # windows?\r\n # TODO: windows notification\r\n pass\r\n\r\n except:\r\n # skip the notification error\r\n pass\r\n\r\n\r\ndef help():\r\n appname = sys.argv[0]\r\n appname = appname if appname.endswith(\'.py\') else \'tomato\' # tomato is pypi package\r\n print(\'====== 🍅 Tomato Clock =======\')\r\n print(f\'{appname} # start a {WORK_MINUTES} minutes tomato clock + {BREAK_MINUTES} minutes break\')\r\n print(f\'{appname} -t # start a {WORK_MINUTES} minutes tomato clock\')\r\n print(f\'{appname} -t <n> # start a <n> minutes tomato clock\')\r\n print(f\'{appname} -b # take a {BREAK_MINUTES} minutes break\')\r\n print(f\'{appname} -b <n> # take a <n> minutes break\')\r\n print(f\'{appname} -h # help\')\r\n\r\n\r\nif __name__ == \"__main__\":\r\n main()', 1);
INSERT INTO `onefile` VALUES (17, 'share', 'Python', '基于 HTTP 协议的文件分享工具', 12, 'https://github.com/beavailable/share', 8200, '#!/bin/env python3\r\nimport sys\r\nimport signal\r\nimport os\r\nimport argparse\r\nimport functools\r\nfrom http.server import ThreadingHTTPServer, BaseHTTPRequestHandler, HTTPStatus\r\nfrom http import cookies\r\nfrom urllib import parse\r\nimport html\r\nimport mimetypes\r\nimport shutil\r\nimport base64\r\nimport time\r\nimport io\r\nimport stat\r\nimport re\r\nimport socket\r\n\r\n\r\nclass ShareServer(ThreadingHTTPServer):\r\n\r\n def __init__(self, *args, **kwargs):\r\n if is_windows():\r\n self._print_error = self._print_error_windows\r\n else:\r\n self._print_error = self._print_error_unix\r\n super().__init__(*args, **kwargs)\r\n\r\n def handle_error(self, request, client_address):\r\n year, month, day, hh, mm, ss, x, y, z = time.localtime()\r\n t, value, traceback = sys.exc_info()\r\n self._print_error(f\'{year:04}/{month:02}/{day:02} {hh:02}:{mm:02}:{ss:02} - {client_address[0]}:{client_address[1]} - {t.__name__}: {value}\')\r\n\r\n def _print_error_windows(self, msg):\r\n sys.stderr.write(f\'{msg}\\n\')\r\n\r\n def _print_error_unix(self, msg):\r\n sys.stderr.write(f\'\\033[33m{msg}\\033[0m\\n\')\r\n\r\n\r\nclass BaseHandler(BaseHTTPRequestHandler):\r\n\r\n protocol_version = \'HTTP/1.1\'\r\n ico = base64.b64decode(\'AAABAAMAMDAAAAEAIACoJQAANgAAACAgAAABACAAqBAAAN4lAAAQEAAAAQAgAGgEAACGNgAAKAAAADAAAABgAAAAAQAgAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHGzPAFxszwhcbM8U3GzPGZxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8Z3GzPGdxszxncbM8ZnGzPFNxszwhcbM8AQAAAAAAAAAAAAAAAAAAAAAAAAAAcbM8B3GzPGxxszzccbM8/HGzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPPxxszzccbM8bHGzPAcAAAAAAAAAAAAAAAAAAAAAcbM8bHGzPPZxszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM89nGzPGwAAAAAAAAAAAAAAABxszwhcbM823GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPNtxszwhAAAAAAAAAABxszxTcbM8+3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPPtxszxTAAAAAAAAAABxszxmcbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxmAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8+3GzPOFxszzHcbM8x3GzPOFxszz8cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszzccbM8bHGzPCJxszwMcbM8DXGzPCJxszxscbM83XGzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPNNxszw3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcbM8OHGzPNRxszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM88XGzPE0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHGzPE5xszzycbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8s3GzPAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHGzPAlxszy0cbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPP9xszxnAAAAAAAAAABxszxncbM8/3GzPP9xszz/cbM8/3GzPP9xszz/cbM8/3GzPLine truncated
INSERT INTO `onefile` VALUES (18, 'web-server', 'Python', '一个简单的 Web 框架', 12, 'https://github.com/521xueweihan/OneFile/blob/main/src/python/web-server.py', 9700, '#!/usr/bin/env python\r\n# -*- coding:utf-8 -*-\r\n#\r\n# Author : XueWeiHan\r\n# E-mail : 595666367@qq.com\r\n# Date : 2022-03-29 16:56\r\n# Desc : 迷你 Web 服务器\r\nimport sys\r\nimport socket\r\nimport selectors\r\nimport datetime\r\nimport time\r\nimport html\r\n\r\n# 默认错误信息 HTML 模版\r\nDEFAULT_ERROR_MESSAGE = \"\"\"\\\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\r\n \"http://www.w3.org/TR/html4/strict.dtd\">\r\n<html>\r\n <head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\r\n <title>Error response</title>\r\n </head>\r\n <body>\r\n <h1>Error response</h1>\r\n <p>Error code: %(code)d</p>\r\n <p>Message: %(message)s.</p>\r\n <p>Error code explanation: %(code)s - %(explain)s.</p>\r\n </body>\r\n</html>\r\n\"\"\"\r\n\r\n# 处理连接进行数据通信\r\nclass HTTPServer(object):\r\n def __init__(self, server_address, RequestHandlerClass):\r\n self.server_address = server_address\r\n self.RequestHandlerClass = RequestHandlerClass\r\n self.request_queue_size = 5\r\n self.__shutdown_request = False\r\n\r\n # 创建 TCP Socket\r\n self.socket = socket.socket(socket.AF_INET,\r\n socket.SOCK_STREAM)\r\n try:\r\n # 绑定 socket 和端口\r\n self.server_bind()\r\n # 开始监听端口\r\n self.server_activate()\r\n except:\r\n # 关闭 socket\r\n self.server_close()\r\n raise\r\n\r\n def server_bind(self):\r\n self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\r\n # 绑定端口\r\n self.socket.bind(self.server_address)\r\n\r\n def server_activate(self):\r\n # 监听端口\r\n self.socket.listen(self.request_queue_size)\r\n\r\n def server_close(self):\r\n # 关闭socket\r\n self.socket.close()\r\n\r\n def fileno(self):\r\n \"\"\"\r\n 返回 socket 文件号\r\n 用于 select 监控文件句柄状态\r\n \"\"\"\r\n return self.socket.fileno()\r\n\r\n def serve_forever(self, poll_interval=0.5):\r\n \"\"\"\r\n 服务器启动入口\r\n \"\"\"\r\n\r\n with selectors.SelectSelector() as selector:\r\n # 基于 select 轮询获取已准备好的可读句柄\r\n selector.register(self, selectors.EVENT_READ)\r\n while True:\r\n ready = selector.select(poll_interval)\r\n if ready:\r\n # 有准备好的可读文件句柄,则与客户端的链接建立完毕\r\n # 可以进行下一步\r\n self._handle_request_noblock()\r\n\r\n def _handle_request_noblock(self):\r\n \"\"\"\r\n 处理请求\r\n \"\"\"\r\n try:\r\n # 接收来自客户端的请求:request 对象\r\n request, client_address = self.get_request()\r\n except socket.error:\r\n return\r\n try:\r\n # 开始处理请求\r\n self.process_request(request, client_address)\r\n except:\r\n self.handle_error(client_address)\r\n self.shutdown_request(request)\r\n\r\n def get_request(self):\r\n # 接收请求\r\n return self.socket.accept()\r\n\r\n def process_request(self, request, client_address):\r\n # 处理请求\r\n self.finish_request(request, client_address)\r\n self.shutdown_request(request)\r\n\r\n def finish_request(self, request, client_address):\r\n # 调用处理请求的类\r\n self.RequestHandlerClass(request, client_address, self)\r\n\r\n def shutdown_request(self, request):\r\n try:\r\n # 后续不允许发送和接收\r\n request.shutdown(socket.SHUT_WR)\r\n except socket.error:\r\n pass # some platforms may raise ENOTCONN here\r\n # 结束请求\r\n request.close()\r\n\r\n def handle_error(self, client_address):\r\n print(\'-\'*40, file=sys.stderr)\r\n print(\'Exception occurred during processing of request from\',\r\n client_address, file=sys.stderr)\r\n import traceback\r\n traceback.print_exc()\r\n print(\'-\'*40, file=sys.stderr)\r\n\r\n# 处理请求\r\nclass HTTPRequestHandler(object):\r\n responses = {\r\n 100: (\'Continue\', \'Request received, please continue\'),\r\n 101: (\'Switching Protocols\',\r\n \'Switching to new protocol; obey Upgrade header\'),\r\n\r\n 200: (\'OK\', \'Request fulfilled, document follows\'),\r\n 201: (\'Created\', \'Document created, URL Line truncated
-- ----------------------------
-- Table structure for project
@@ -179,10 +219,10 @@ CREATE TABLE `project` (
-- ----------------------------
-- Records of project
-- ----------------------------
INSERT INTO `project` VALUES (26, 12, 'agarrharr/awesome-macos-screensavers', 'https://github.com/agarrharr/awesome-macos-screensavers', 'https://avatars.githubusercontent.com/u/3266363?v=4', '令人惊艳的 macOS 屏保集合', '这里有不同风格、样式、趣味性十足的 macOS 屏保,相信总有一款适合你。', 0, '2023-07-10 16:08:35', 15, 1, NULL, 1, 59, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (27, 12, 'microsoft/AI-For-Beginners', 'https://github.com/microsoft/AI-For-Beginners', 'https://avatars.githubusercontent.com/u/6154722?v=4', '微软开源的入门级人工智能教程', '这是一份完全免费、面向零基础人群的 AI 课程,为期 12 周共计 24 节课。你将学习到关于 AI 的历史、基本知识、主流框架、CV 和 NLP 等知识。', 1, '2023-07-10 17:10:07', 15, 1, NULL, 1, 18, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (32, 12, 'loft-sh/devpod', 'https://github.com/loft-sh/devpod', 'https://avatars.githubusercontent.com/u/65466868?v=4', '连接本地 IDE 和远程开发环境的工具', '它通过在本地启动一个连接远程开发机器的容器,让开发环境跑在容器里,从而轻松启动任何开发环境。支持 K8s 集群、云端虚拟机、任何可访问的远程机器,还能够自动关闭云服务降低成本。', 0, '2023-07-10 21:28:34', 5, 1, NULL, 0, 2, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (43, 13, 'facebook/redex', 'https://github.com/facebook/redex', 'https://avatars.githubusercontent.com/u/69631?v=4', '优化 Android 应用的字节码优化器', 'Facebook 开源的字节码优化器,它提供了一个框架,可用来读取、写入和分析 .dex 文件,并使用这个框架进行一系列的优化处理来改进字节码。经过 ReDex 优化后的 APK 会比其源文件更小且更快。', 0, '2023-07-10 22:54:53', 3, 1, NULL, 0, 5, '2023-07-10 22:54:53');
INSERT INTO `project` VALUES (26, 12, 'agarrharr/awesome-macos-screensavers', 'https://github.com/agarrharr/awesome-macos-screensavers', 'https://avatars.githubusercontent.com/u/3266363?v=4', '令人惊艳的 macOS 屏保集合', '这里有不同风格、样式、趣味性十足的 macOS 屏保,相信总有一款适合你。', 0, '2023-07-10 16:08:35', 15, 1, NULL, 1, 77, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (27, 12, 'microsoft/AI-For-Beginners', 'https://github.com/microsoft/AI-For-Beginners', 'https://avatars.githubusercontent.com/u/6154722?v=4', '微软开源的入门级人工智能教程', '这是一份完全免费、面向零基础人群的 AI 课程,为期 12 周共计 24 节课。你将学习到关于 AI 的历史、基本知识、主流框架、CV 和 NLP 等知识。', 1, '2023-07-10 17:10:07', 15, 1, NULL, 1, 23, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (32, 12, 'loft-sh/devpod', 'https://github.com/loft-sh/devpod', 'https://avatars.githubusercontent.com/u/65466868?v=4', '连接本地 IDE 和远程开发环境的工具', '它通过在本地启动一个连接远程开发机器的容器,让开发环境跑在容器里,从而轻松启动任何开发环境。支持 K8s 集群、云端虚拟机、任何可访问的远程机器,还能够自动关闭云服务降低成本。', 0, '2023-07-10 21:28:34', 5, 1, NULL, 0, 7, '2023-07-10 22:29:58');
INSERT INTO `project` VALUES (43, 13, 'facebook/redex', 'https://github.com/facebook/redex', 'https://avatars.githubusercontent.com/u/69631?v=4', '优化 Android 应用的字节码优化器', 'Facebook 开源的字节码优化器,它提供了一个框架,可用来读取、写入和分析 .dex 文件,并使用这个框架进行一系列的优化处理来改进字节码。经过 ReDex 优化后的 APK 会比其源文件更小且更快。', 0, '2023-07-10 22:54:53', 3, 1, NULL, 0, 11, '2023-07-10 22:54:53');
-- ----------------------------
-- Table structure for project_category