Skip to content

Instantly share code, notes, and snippets.

View tongyx361's full-sized avatar

Shawn/Yuxuan Tong tongyx361

View GitHub Profile
@h0bbel
h0bbel / sources.list
Last active June 29, 2024 11:13
/etc/apt/sources.list for Ubuntu 18.04.1 LTS Bionic Beaver
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
@fcaldera
fcaldera / .zshrc
Last active July 4, 2024 15:41
zsh configuration with zplug
export ZPLUG_HOME=/usr/local/opt/zplug
# Essential
source $ZPLUG_HOME/init.zsh
# Async for zsh, used by pure
zplug "mafredri/zsh-async", from:github, defer:0
# oh-my-zsh
zplug "lib/completion", from:oh-my-zsh
@neubig
neubig / dispatch_openai_requests.py
Last active February 19, 2024 17:55
A simple script to get results from the OpenAI Asynchronous API
# NOTE:
# You can find an updated, more robust and feature-rich implementation
# in Zeno Build
# - Zeno Build: https://github.com/zeno-ml/zeno-build/
# - Implementation: https://github.com/zeno-ml/zeno-build/blob/main/zeno_build/models/providers/openai_utils.py
import openai
import asyncio
from typing import Any
@tongyx361
tongyx361 / gpu-monitor-with-executor-and-email.py
Created August 1, 2023 17:10
Python script that monitors GPU usage on a machine and executes jobs when GPUs are available.
"""
GPU Monitor with Email and Execution
This script monitors the usage of GPUs on a system and, when there are enough free GPUs, execute a specified function.
The function run a bash script by default but could be any other executable code.
This script uses the GPUtil library to monitor GPU usage.
Preparation:
1. `pip install GPUtil`
2. define your own `func` if needed