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 / LangGraph_Test.ipynb
Last active October 22, 2024 07:28
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>
@daviddwlee84
daviddwlee84 / Dockerfile
Last active December 16, 2020 11:40
Quick start Elastic Search docker with Chinese support
FROM docker.elastic.co/elasticsearch/elasticsearch:7.9.0
# Install plugins for Chinese support
RUN bin/elasticsearch-plugin install analysis-smartcn
RUN bin/elasticsearch-plugin install --batch https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.0/elasticsearch-analysis-ik-7.9.0.zip
@daviddwlee84
daviddwlee84 / GoogleChromeDinosaurBOT.js
Last active April 22, 2022 11:16
When you have no internet while using Chrome (or go to chrome://dino). Copy and paste this code into console (F12) and press space to make Dinosaur come to life!!
config = {
'updateInterval' : 33,
'autoRestart' : false,
'restartTimeout' : 1000,
'intergateArduino' : true
};
littleDinoLoaded = false;
function loadLittleDino() {