首页
关于
时光机
Github
更多
文章归档
友情链接
Search
1
live/msn等微软绝版邮箱详细的注册教程
4,663 阅读
2
欢迎使用 Typecho
3,143 阅读
3
一个功能强大又好用的RSS订阅器:FreshRSS安装教程
2,485 阅读
4
使用Aria2下载BT磁力的时候,速度慢或者没速度的解决方法
2,164 阅读
5
VPS使用BaiduPCS-Go高速下载百度网盘的文件,支持上传/离线下载等操作
1,986 阅读
默认分类
主机教程
登录
Search
标签搜索
no tag
暂无标签
短篇文学
OI 成都外国语学校 日记
短篇文学 封面
干货教程
typecho
python
eve
程序源码源码星泽V社 封面
星泽V社 封面
linux
OI
PHP
mysql
实用软件
kali
OI 题解 成都外国语学校
漏洞利用
Java
Typecho
累计撰写
2,547
篇文章
累计收到
3
条评论
首页
栏目
默认分类
主机教程
页面
关于
时光机
Github
文章归档
友情链接
搜索到
72
篇与
的结果
2023-10-05
给win10安装一些有必要用的工具
给win10安装一些有必要用的工具Tcping 将下载文件放到 C:\Windows\System32\ 并确保名字为tcping.exe即和Linux一样使用tcping命令。 Tcping下载地址Curl poweshell poweshell可以尝试choco install curl直接命令安装 升级 choco upgrade curl 卸载 choco uninstall curl 解压安装Curl下载地址 下载后,直接解压缩,解压后打开自己的解压目录,复制上面的路径,如 C:\Users\dnslin\Downloads\Compressed\curl-7.77.0-win64-mingw\bin 设置环境变量:选中我的电脑--> 右击-->属性--> 高级系统设置 配置path就ok了 curl --helpWget 将下载好的wget.exe放到 C:/windows/system32文件夹下 Wget下载地址Whois 下载解压后,会看到 WhoisCL.exe 这个文件,改名为 whois.exe 并复制到 C:\Windows\System32\ 目录下即可 然后打开 cmd,输入 whois 回车后,就能看到基本用法和版本号 Whois下载地址
2023年10月05日
264 阅读
0 评论
0 点赞
2023-10-05
首图备份
1212.png 1213.png 1214.png 1215.png 1216.png 1210.png 1211.png
2023年10月05日
285 阅读
0 评论
0 点赞
2023-10-05
如何实现用自定义注解导出Excel自定义表头
如何实现用自定义注解导出Excel自定义表头其实上述功能在很多的轮子里都已经有现成的实现方法,例如阿里的 EasyExcel 等等我这里只是举例其中实现的一种方式,外加多写一篇博文代码设计其实就用到了下述文件@Excel 注解 @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @Documented public @interface Excel { String name() default ""; String dictValue() default ""; }pom.xml POI的相关依赖 org.apache.poi poi 5.2.2 org.apache.poi poi-ooxml 5.2.2 // 假定的数据集 public class User { private String id; @Excel(name = "姓名") private String name; @Excel(name = "年龄") private int age; /** * 性别 0-女 1-男 */ @Excel(name = "性别", dictValue = "0=女,1=男") private int gender; }// 具体实现的逻辑 public class ExcelExport { public static void main(String[] args) throws IOException { List users = List.of( new User("张三", 20, 1), new User("李四", 30, 0), new User("王五", 40, 1) ); // 写入文件 OutputStream outputStream = Files.newOutputStream(Paths.get("C:\\Users\\dnslin\\Downloads\\Programs\\users.xlsx")); // 执行导出方法 ExcelExport.export(users, outputStream); } private static void export(List users, OutputStream outputStream) { try (Workbook workbook = new XSSFWorkbook()) { Sheet sheet = workbook.createSheet(); // 获取所有包含注解的字段 Field[] declaredFields = User.class.getDeclaredFields(); List collect = Arrays.stream(declaredFields) .filter(e -> e.isAnnotationPresent(Excel.class)) .collect(Collectors.toList()); // 写入标题行 writeTitleRow(sheet, collect); // 写入数据行 for (int i = 0; i < users.size(); i++) { User user = users.get(i); Row userRow = sheet.createRow(i + 1); writeDataRow(userRow, user, collect); } // 写入文件 workbook.write(outputStream); } catch (Exception e) { throw new RuntimeException(e); } } private static void writeDataRow(Row userRow, User user, List collect) throws IllegalAccessException { Map fieldDict = buildFieldDict(collect); for (int i = 0; i < collect.size(); i++) { Cell cell = userRow.createCell(i); Field field = collect.get(i); field.setAccessible(true); Excel annotation = field.getAnnotation(Excel.class); if (annotation.dictValue()!=null && !annotation.dictValue().isEmpty()){ String key = String.valueOf(field.get(user)); cell.setCellValue(fieldDict.get(field).get(key)); }else { cell.setCellValue(String.valueOf(field.get(user))); } field.setAccessible(false); } } private static Map buildFieldDict(List collect) { HashMap fieldMapHashMap = new HashMap(); collect.forEach(e->{ Excel annotation = e.getAnnotation(Excel.class); String dictValue = annotation.dictValue(); if (dictValue != null && !dictValue.isEmpty()) { String[] split = dictValue.split(","); Map dict = Arrays.stream(split) .map(s -> s.split("=")) .collect(Collectors.toMap(e1 -> e1[0], e1 -> e1[1])); fieldMapHashMap.put(e, dict); } }); return fieldMapHashMap; } private static void writeTitleRow(Sheet sheet, List collect) { Row row = sheet.createRow(0); for (int i = 0; i < collect.size(); i++) { Cell cell = row.createCell(i); Excel excel = collect.get(i).getAnnotation(Excel.class); cell.setCellValue(excel.name()); } }
2023年10月05日
222 阅读
0 评论
0 点赞
2023-10-05
没有总结的年终总结
没有总结的年终总结胡言乱语似乎去年的想法今年一个也没实现,浑浑噩噩的度过了一年,每天晚上睡觉之前都是第二天要精神饱满的起来努力学习努力工作,似乎每天都是这样的三天打鱼两天晒网,我的拖延症或许已经到了癌症晚期的地步,学了一年的前端也没写出一个什么好的页面,自诩为什么都会一点的程序员,其实应该是什么都不会。今年不想立下什么目标了,努力活下去就好了,要是今年能遇到我的真命天女就好了 哈哈哈!
2023年10月05日
206 阅读
0 评论
0 点赞
2023-10-05
加速Github的访问和克隆
如何反向代理 Github 文件下载,Git clone其实有很多方法例如 Sniproxy,Nginx 反向代理等等这里我直接在Github上找了一个现成的轮子进行搭建的 https://github.com/hunshcn/gh-proxy一、docker部署你可以使用 dockerfile 自己进行构建,也可以用 DockerHub 现成的镜像:gh-proxy-py:latestdocker run -d --name="gh-proxy-py" \ -p 0.0.0.0:80:80 \ --restart=always \ hunsh/gh-proxy-py:latestDockerFileFROM guysoft/uwsgi-nginx:python3.7 LABEL maintainer="hunshcn " RUN pip install flask requests COPY ./app /app WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] # Run the start script provided by the parent image tiangolo/uwsgi-nginx. # It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI EXPOSE 80 CMD ["/start.sh"]二、cf worker版本部署和普通的worker一样 创建worker后直接用 index.js 直接覆盖就行了'use strict' /** * static files (404.html, sw.js, conf.js) */ const ASSET_URL = 'https://hunshcn.github.io/gh-proxy/' // 前缀,如果自定义路由为example.com/gh/*,将PREFIX改为 '/gh/',注意,少一个杠都会错! const PREFIX = '/' // 分支文件使用jsDelivr镜像的开关,0为关闭,默认关闭 const Config = { jsdelivr: 0 } const whiteList = [] // 白名单,路径里面有包含字符的才会通过,e.g. ['/username/'] /** @type {RequestInit} */ const PREFLIGHT_INIT = { status: 204, headers: new Headers({ 'access-control-allow-origin': '*', 'access-control-allow-methods': 'GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS', 'access-control-max-age': '1728000', }), } const exp1 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:releases|archive)\/.*$/i const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob|raw)\/.*$/i const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-).*$/i const exp4 = /^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+?\/.+$/i const exp5 = /^(?:https?:\/\/)?gist\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+$/i const exp6 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/tags.*$/i /** * @param {any} body * @param {number} status * @param {Object} headers */ function makeRes(body, status = 200, headers = {}) { headers['access-control-allow-origin'] = '*' return new Response(body, {status, headers}) } /** * @param {string} urlStr */ function newUrl(urlStr) { try { return new URL(urlStr) } catch (err) { return null } } addEventListener('fetch', e => { const ret = fetchHandler(e) .catch(err => makeRes('cfworker error:\n' + err.stack, 502)) e.respondWith(ret) }) function checkUrl(u) { for (let i of [exp1, exp2, exp3, exp4, exp5, exp6]) { if (u.search(i) === 0) { return true } } return false } /** * @param {FetchEvent} e */ async function fetchHandler(e) { const req = e.request const urlStr = req.url const urlObj = new URL(urlStr) let path = urlObj.searchParams.get('q') if (path) { return Response.redirect('https://' + urlObj.host + PREFIX + path, 301) } // cfworker 会把路径中的 `//` 合并成 `/` path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://') if (path.search(exp1) === 0 || path.search(exp5) === 0 || path.search(exp6) === 0 || path.search(exp3) === 0 || path.search(exp4) === 0) { return httpHandler(req, path) } else if (path.search(exp2) === 0) { if (Config.jsdelivr) { const newUrl = path.replace('/blob/', '@').replace(/^(?:https?:\/\/)?github\.com/, 'https://cdn.jsdelivr.net/gh') return Response.redirect(newUrl, 302) } else { path = path.replace('/blob/', '/raw/') return httpHandler(req, path) } } else if (path.search(exp4) === 0) { const newUrl = path.replace(/(?
2023年10月05日
272 阅读
0 评论
0 点赞
1
2
...
15