Skip to content

Instantly share code, notes, and snippets.

View fanyix's full-sized avatar
🎯
Focusing

Fanyi Xiao fanyix

🎯
Focusing
View GitHub Profile
@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
@mblondel
mblondel / check_convex.py
Last active March 21, 2022 22:25
A small script to get numerical evidence that a function is convex
# Authors: Mathieu Blondel, Vlad Niculae
# License: BSD 3 clause
import numpy as np
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose):
rng = np.random.RandomState(random_state)
# if tuple, interpret as randn
@haotian-liu
haotian-liu / sendmail.py
Created October 19, 2018 04:12
Send Email with SMTP using Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
mail_host = "smpt.xxxx.com"
mail_user = "[email protected]"
mail_pass = "password"