Skip to content

Instantly share code, notes, and snippets.

View GrayXu's full-sized avatar

Guanglei Xu GrayXu

View GitHub Profile
@GrayXu
GrayXu / price.json
Last active August 8, 2024 07:47
personal price.json for one-hub
[
{
"model": "llama3-70b-instruct",
"type": "tokens",
"channel_type": 17,
"input": 0,
"output": 0
},
{
"model": "meta-llama/Meta-Llama-3-8B-Instruct",
@GrayXu
GrayXu / num2uid.py
Created September 7, 2023 10:53
num2uid.py
import struct
num = 1111111111 # only for test
reverted = struct.pack('>L', num)
asChar = list(reverted)
result = asChar[0] ^ asChar[1] ^ asChar[2] ^ asChar[3]
uidr = hex(num)[2:]
assert(len(uidr)==8)
uid = uidr[6:8]+uidr[4:6]+uidr[2:4]+uidr[0:2]
@GrayXu
GrayXu / Register_OpenAI_GPT_API.md
Last active October 10, 2024 11:53
Register OpenAI GPT API

This gist is for zotero-pdf-translate.
Please ask your question at repo issues for faster responses
请在仓库issue进行提问以获得更快的回复


  1. Register an account on the OpenAI website.
  2. After successful registration, go to API keys and create an key, which looks like sk-XXXXXX.
  3. Fill in the url with the complete URL, such as https://api.openai.com/v1/chat/completions.
  4. For the model, enter a model name such as gpt-4o.
@GrayXu
GrayXu / neteasemusic_ipcidr.txt
Created February 16, 2023 10:34
neteasemusic_ipcidr for clash-rules
payload:
- '39.105.63.80/32'
- '45.254.48.1/32'
- '47.100.127.239/32'
- '59.111.21.14/31'
- '59.111.179.214/32'
- '59.111.181.38/32'
- '59.111.181.60/32'
- '59.111.160.195/32'
- '59.111.160.197/32'
@GrayXu
GrayXu / neteasemusic_domain.txt
Created February 16, 2023 10:33
neteasemusic_domain for clash-rules
payload:
- '+.163yun.com'
- '+.music.163.com'
- '+.interface.music.163.com'
- '+.clientlog.music.163.com'
- '+.music.126.net'
- '+.api.iplay.163.com'
- '+.apm.music.163.com'
- '+.apm3.music.163.com'
- '+.interface.music.163.com'
@GrayXu
GrayXu / myjm.csl
Created December 24, 2022 13:11
Zotero reference GB/T style for dblp BibTeX records
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.1mlz1" demote-non-dropping-particle="sort-only" default-locale="zh-CN">
<info>
<title>MYJM</title>
<id>MYJM</id>
<link href="http://juris-m.github.io/jm-styles/jm-chinese-gb7714-2005-numeric" rel="self"/>
<link href="http://gradschool.ustc.edu.cn/ylb/material/xw/wdxz/19.pdf" rel="documentation"/>
<author>
<name>heromyth</name>
<email>[email protected]</email>
#!/bin/bash
# author: louwrentius
# source: http://louwrentius.com/zfs-on-linux-monitor-cache-hit-ratio.html
INTERVAL="$1"
if [ -z $INTERVAL ]
then
INTERVAL=5
@GrayXu
GrayXu / Awesome Ph.D advice lists.md
Last active January 20, 2024 13:44
Awesome Ph.D advice lists
@GrayXu
GrayXu / uBlacklist.txt
Last active January 11, 2022 11:57
用于屏蔽谷歌搜索的垃圾中文站的uBlacklist。用于补充penzai等list没cover的。
*://www.clqcqz.com/*
*://chaosou.cc/*
*://yo.zgserver.com/*
*://www.cxymm.net/*
*://m.lacestion.com/*
*://159.138.37.243/*
*://www.i4k.xyz/*
*://www.cxybb.com/*
*://githubhelp.com/*
*://yiyu.gaoyongboke.com/*
@GrayXu
GrayXu / md2csv.py
Last active March 26, 2021 10:15
convert markdown table to csv
# warning: catch dirty corner case, but will not handle it
with open("2020Mar.md") as f:
data = f.readlines()
lengths = []
ll = []
for line in data:
items = line.split("|")[1:-1]
lengths.append(len(items))
for j in range(len(items)):