Skip to content

Instantly share code, notes, and snippets.

View daviddwlee84's full-sized avatar
💭
Just wanna be happier

David Lee daviddwlee84

💭
Just wanna be happier
View GitHub Profile
@daviddwlee84
daviddwlee84 / EastMoneyPicture.html
Last active April 11, 2025 03:14
Easily get A-Share symbol market data as image from Easy Money
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>EastMoney K-line Picture Viewer</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 2em;
}
@daviddwlee84
daviddwlee84 / server.py
Last active April 10, 2025 06:39
A Python real-time dashboard with TradingView Lightweight Chart example (by vibe coding)
import asyncio
import random
import time
from contextlib import asynccontextmanager
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from fastapi.responses import HTMLResponse
# Store connected WebSocket clients globally
connected_clients = []
# Task references to properly manage background tasks
@daviddwlee84
daviddwlee84 / LangGraph_Test.ipynb
Last active December 28, 2024 11:53
LangGraph Quick Start Tutorial https://langchain-ai.github.io/langgraph/tutorials/introduction/ but using OpenAI and DuckDuckGo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@daviddwlee84
daviddwlee84 / negative_cycle_detector.py
Created September 20, 2024 05:30
Negative Cycle Detector (using NetworkX)
# Python 3.11
# https://peps.python.org/pep-0673/
from typing import Literal, Self
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
class NegCycleDetector:
@daviddwlee84
daviddwlee84 / subscribe_thorugh_socks5_proxy.py
Last active August 13, 2024 06:44
Subscribe DEPTH and TRADE from Pionex WebSocket with Socks5 Proxy
from urllib.parse import urlparse
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PySocks websockets asyncio
import asyncio
import ssl
# https://github.com/Anorov/PySocks
import socks
# https://github.com/python-websockets/websockets
import websockets
import json
@daviddwlee84
daviddwlee84 / gpu_lock_with_arguments.py
Last active July 23, 2024 10:09
A PyTorch training script that can find an available GPU to train (otherwise will wait) with lock protection and custom arguments for parameters. https://chatgpt.com/share/4c82e79d-c80b-4d06-b802-fa7a8cf34ee8 https://chatgpt.com/share/1d02b8c2-78c5-44cc-8db5-b1cad0c4e191
from typing import Tuple
import GPUtil
import torch
import time
import os
from filelock import FileLock
from tap import Tap
# pip install gputil torch filelock typed-argument-parser
@daviddwlee84
daviddwlee84 / .s3cfg
Last active May 31, 2024 08:18
Read S3 Parquet using config of `~/.s3cfg` (shared with `s3cmd`)
# ~/.s3cfg
[default]
access_key = AAAAAAAAAAAAAAAAAAAA
bucket_location = US
host_base = url.to.minio
secret_key = 0000000000000000000000000000000000000000000
@daviddwlee84
daviddwlee84 / fingpt_forecaster.ipynb
Last active June 13, 2024 09:00
fingpt_forecaster.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<title>Execution Log Monitor</title>
</head>
<body>
<div id="log-container"></div>