Skip to content

Instantly share code, notes, and snippets.

View hzhangxyz's full-sized avatar

Hao Zhang(张浩) hzhangxyz

View GitHub Profile
@hzhangxyz
hzhangxyz / main.py
Last active September 23, 2023 13:26
gpt-3.5-instruct-webui.py
import os
import openai
import asyncio
import gradio as gr
MODEL = "gpt-3.5-turbo-instruct"
if "OPENAI_PROXY" in os.environ:
openai.proxy = os.environ["OPENAI_PROXY"]
openai.api_key = os.environ["OPENAI_API_KEY"]
@hzhangxyz
hzhangxyz / haskell.md
Created May 21, 2025 08:04
haskell.md

Monad

pure vs impure

  • pure
def add(a: int, b: int) -> int:
    return a + b
@hzhangxyz
hzhangxyz / learn-autograd.ipynb
Last active July 9, 2025 10:12
learn-autograd.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <format>
#include <print>
#include <string>
#include <vector>
struct Dog {
std::string name;
void Say() const {
std::print("{}: Woof!\n", name);
}
@hzhangxyz
hzhangxyz / log.txt
Created August 11, 2025 02:47
check-for-ib-net
command:
for j in `seq 2 6`; do ip=192.168.0.$j; echo $ip; for i in `seq 0 7`; do id=`talosctl --nodes $ip ls /sys/class/infiniband/mlx5_$i --long | grep device | awk '{print $12}' | sed 's/\.\.\///g'`; echo $id; talosctl --nodes $ip cat /sys/bus/pci/devices/$id/class; done; echo; done;
output:
192.168.0.2
0000:29:00.0
0x020000
0000:3b:00.0
0x020000
0000:4b:00.0