This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import os | |
import sys | |
import openai | |
import tiktoken | |
from termcolor import colored | |
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"schema_version": "v1", | |
"name_for_model": "twilio", | |
"name_for_human": "Twilio Plugin", | |
"description_for_model": "Plugin for integrating the Twilio API to send SMS messages and make phone calls. Use it whenever a user wants to send a text message or make a call using their Twilio account.", | |
"description_for_human": "Send text messages and make phone calls with Twilio.", | |
"auth": { | |
"type": "user_http", | |
"authorization_type": "basic" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compare different embedding methods. | |
import os | |
import hashlib | |
import email | |
import email.policy | |
import tqdm | |
import time | |
import random | |
import numpy as np | |
from sklearn.metrics.pairwise import cosine_similarity # for testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~~~magictext~~~ | |
# update FILENAME to your file name | |
!jupyter nbconvert --to script --output "/tmp/copy" FILENAME.ipynb | |
# Trim empty lines from /tmp/copy.py | |
!sed -i '' '/^$/d' /tmp/copy.py | |
# Trim lines that start with "# In[" | |
!sed -i '' '/^# In\[/d' /tmp/copy.py | |
# Remove this very section, e.g. anything after "# ~~~magictext~~~" | |
!sed -i '' '/# ~~~magictext~~~/,$d' /tmp/copy.py | |
!cat /tmp/copy.py | pbcopy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Stream a response from the OpenAI completion API.""" | |
import os | |
import re | |
import sys | |
import time | |
import random | |
import openai | |
openai.api_key = open(os.path.expanduser("~/.openai")).read().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export all calendars as zip file from Gcal to a folder (e.g. ~/Downloads). Run this file there. | |
# Requires icalendar and isoweek. | |
import csv | |
from icalendar import Calendar, Event | |
import datetime | |
import glob | |
import isoweek | |
import subprocess | |
import os | |
import collections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use GPT-3 to generate a calendar event based on natural language input. | |
I tried having GPT-3 generate the URL directly, but, amusingly, that didn't work well. | |
""" | |
import os | |
import sys | |
import openai | |
import datetime | |
import pytz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Chat with GPT-3 from the Terminal.""" | |
import os | |
import openai | |
if os.path.exists(os.path.expanduser("~/.openai")): | |
openai.api_key = open(os.path.expanduser("~/.openai")).read().strip() | |
else: | |
print("Enter your OpenAI API key: ", end="") | |
openai.api_key = input() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
from PIL import Image | |
import io | |
import time | |
import os | |
import sys | |
import numpy as np | |
from fpdf import FPDF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your bash_profile. | |
# Type `wifi` to list all WiFi networks. | |
# Type `wifi` "SSID_NAME" "PASSWORD" to connect to one. | |
# To tether: | |
# 1. Update tether() with your iPhone SSID and hotspot password. | |
# 2. Open Control Center. | |
# 3. Long-press (force touch) Bluetooth. | |
# 4. Turn OFF Wifi and turn ON "Personal Hotspot". It should read "Discoverable". | |
# 5. Don't leave that screen or state. |
NewerOlder