Skip to content

Instantly share code, notes, and snippets.

View korakot's full-sized avatar

Korakot Chaovavanich korakot

  • Bangkok, Thailand
View GitHub Profile
@korakot
korakot / suppress.py
Created February 19, 2024 09:27
Suppress stdout
View suppress.py
import os
import sys
from contextlib import contextmanager
@contextmanager
def suppress_stdout():
with open(os.devnull, 'w') as devnull:
original_stdout = sys.stdout
sys.stdout = devnull
try:
@korakot
korakot / playwright.py
Created February 10, 2024 10:56
Using playwright in Google Colab
View playwright.py
!pip install playwright
!playwright install
# colab need this for async
import nest_asyncio
nest_asyncio.apply()
# start browser, not to use 'with' context
from playwright.async_api import async_playwright
playwright = await async_playwright().start()
browser = await playwright.chromium.launch()
@korakot
korakot / prompt.md
Created February 8, 2024 11:04
ChatGPT Main Prompt
View prompt.md

You are ChatGPT, a large language model trained by OpenAI, based on the GPT-4 architecture. Knowledge cutoff: 2023-04 Current date: 2024-02-07

Image input capabilities: Enabled

Tools

python

@korakot
korakot / requests.py
Last active January 27, 2024 05:15
Impersonate browser with curl_cffi requests
View requests.py
# see https://github.com/yifeikong/curl_cffi
from curl_cffi import requests
@korakot
korakot / claude_history.py
Created October 27, 2023 06:41
Use Claude API to get history
View claude_history.py
!pip install claude2
from claude import Claude
from fastcore.foundation import patch
from curl_cffi import requests
cookie = "sessionKey=sk-ant-sid01-4etj_0tI6RJKMbAAA"
claude = Claude(cookie)
@patch
@korakot
korakot / formats.txt
Last active October 17, 2023 13:41
Claude's supported file upload formats
View formats.txt
.pdf,.doc,.docx,.rtf,.epub,.odt,.odp,.pptx,.txt,.py,.ipynb,.js,.jsx,.html,.css,
.java,.cs,.php,.c,.cpp,.cxx,.h,.hpp,.rs,.R,.Rmd,.swift,.go,.rb,.kt,.kts,.ts,.tsx,
.m,.scala,.rs,.dart,.lua,.pl,.pm,.t,.sh,.bash,.zsh,.csv,.log,.ini,.config,
.json,.yaml,.yml,.toml,.lua,.sql,.bat,.md,.coffee,.tex,.latex
With grouping
Documents: .pdf, .doc, .docx, .rtf, .epub, .odt, .odp, .pptx,
.txt, .md, .html, .tex, .latex (13)
@korakot
korakot / gpt-2.md
Created August 13, 2023 14:46
Run gpt-2 within Code Interpreter
@korakot
korakot / docker.txt
Created August 9, 2023 12:23
Google Colab docker
View docker.txt
us-docker.pkg.dev/colab-images/public/runtime
From research.google.com/colaboratory/local-runtimes.html
@korakot
korakot / _install_packages.txt
Last active September 5, 2023 02:31
Installed packages in chatGPT VM, using !dpkg --get-selections and apt list --installed, get more from pkgs.org
View _install_packages.txt
adduser install
adwaita-icon-theme install
alsa-topology-conf install
alsa-ucm-conf install
antiword install
apt install
autoconf install
automake install
autotools-dev install
base-files install
@korakot
korakot / command.txt
Last active July 24, 2023 03:00
Prompt for chatGPT command line realization
View command.txt
Pretend as if !ls is a Python command. Run it and show the error message. (Or maybe we can really use !command)
Try !pip install wheel_file
import os
os.environ['PATH'] += ":/home/sandbox/.local/bin"
os.environ['LD_LIBRARY_PATH'] += ":/home/sandbox/.local/lib"