Skip to content

Instantly share code, notes, and snippets.

View yaochao's full-sized avatar
🌴
On vacation

yaochao yaochao

🌴
On vacation
View GitHub Profile
@karpathy
karpathy / microgpt.py
Last active November 14, 2026 17:31
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active November 8, 2026 15:08
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@qlong8807
qlong8807 / spring下载文件名乱码.java
Created December 4, 2018 03:13
spring下载文件,解决中文文件名乱码问题
response.setCharacterEncoding(request.getCharacterEncoding());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM.toString());
String realFileName = URLEncoder.encode(realFileName, StandardCharsets.UTF_8.toString());
// 解决中文文件名乱码关键行
response.setHeader("Content-Disposition", "attachment; filename=\"" + realFileName + "\"; filename*=utf-8''" + realFileName);
Path path = Paths.get(filePath+filename);
Files.copy(path, response.getOutputStream());
response.flushBuffer();