Skip to content

Instantly share code, notes, and snippets.

View ozline's full-sized avatar
:octocat:
mess around

ozlinex ozline

:octocat:
mess around
View GitHub Profile
@ozline
ozline / 🎮 Steam playtime leaderboard
Last active June 15, 2024 15:16
Steam Game Record
🔫 Counter-Strike 2 🕘 1530 hrs 43 mins
🔫 Tom Clancy's Rainbow Six Siege 🕘 391 hrs 51 mins
🎮 Apex Legends 🕘 207 hrs 50 mins
🦾 Cyberpunk 2077 🕘 142 hrs 13 mins
🎮 Watch_Dogs 2 🕘 133 hrs 0 mins
@ozline
ozline / defer.go
Created October 17, 2023 05:08
test for defer
func main() {
fmt.Println(test1())
fmt.Println(test2())
fmt.Println(test3())
fmt.Println(test4())
return
}
func test1() (v int) {
@ozline
ozline / callback-manager.go
Last active October 6, 2023 17:13
A small example about callback function management.
package main
import (
"fmt"
"sync"
)
var (
callback map[string]func()
mu sync.Mutex
@ozline
ozline / worker.js
Created July 26, 2023 23:08
Cloudflare OpenAI Proxy
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const fetchAPI = request.url.replace(url.host, 'api.openai.com');
// 部分代理工具,请求又浏览器发起,跨域请求时会先发送一个 preflight 进行检查,也就是 OPTIONS 请求
// 需要响应该请求,否则后续的 POST 会失败