Skip to content

Instantly share code, notes, and snippets.

View lyr-2000's full-sized avatar
🏠
Working from home

lyr-2000

🏠
Working from home
View GitHub Profile
@lyr-2000
lyr-2000 / throttled_transport.go
Created July 5, 2025 16:55 — forked from zdebra/throttled_transport.go
NewThrottledTransport wraps transportWrap with a rate limitter, improvement of https://gist.github.com/MelchiSalins/27c11566184116ec1629a0726e0f9af5 since it allows use of *http.Client
package main
import (
"net/http"
"time"
"golang.org/x/time/rate"
)
// ThrottledTransport Rate Limited HTTP Client
@lyr-2000
lyr-2000 / predictor.py
Created January 25, 2025 13:38 — forked from rollendxavier/predictor.py
Predicting Cryptocurrency Prices with Machine Learning and the CoinGecko API
from flask import Flask, jsonify, render_template, request
import requests
import json
import numpy as np
from sklearn.linear_model import LinearRegression
import time
from sklearn.preprocessing import MinMaxScaler
from datetime import datetime, timedelta
app = Flask(__name__)
@lyr-2000
lyr-2000 / golang-panic-test.go
Created March 9, 2023 06:53 — forked from sedyh/golang-panic-test.go
Golang panic testing
import (
"fmt"
"regexp"
"runtime/debug"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@lyr-2000
lyr-2000 / wsl_clash_proxy.sh
Created April 1, 2022 07:58 — forked from libChan/wsl_clash_proxy.sh
WSL2使用clash for windows代理
# WSL通过Win访问网络,所以WSL的网关指向的是Windows,DNS服务器指向的也是Windows,设置WSL的proxy为win的代理ip+端口即可
# WSL中的DNS server在/etc/resolv.conf中查看,该文件是由/etc/wsl.conf自动生成的。
# 如果关闭了wsl.conf中自动生成resolve.conf并自行修改了resolve.conf,DNS nameserver并不是本机win ip
# 需要开启wsl.conf的自动生成,再运行以下命令
# https://zhuanlan.zhihu.com/p/153124468
# 添加到环境变量设置中,例如~/.zshrc
export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890"
export http_proxy="http://${hostip}:7890"
@lyr-2000
lyr-2000 / jq-ext.js
Created May 13, 2021 04:59
jquery 插件 extend
console.log('111')