Skip to content

Instantly share code, notes, and snippets.

View jamesallain's full-sized avatar

james allain jamesallain

View GitHub Profile
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active September 5, 2024 23:48
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@olooney
olooney / pnorm.sql
Created June 13, 2018 23:28
PostgreSQL pnorm() function calculated the c.d.f. of the normal Gaussian distribution. This function match's R's build in pnorm() function to within +/- 2e-7 over the entire real line. However, it's a constant 1/0 above/below z=+7/-7.
CREATE OR REPLACE FUNCTION pnorm(z double precision) RETURNS double precision AS $$
SELECT CASE
WHEN $1 >= 0 THEN 1 - POWER(((((((0.000005383*$1+0.0000488906)*$1+0.0000380036)*$1+0.0032776263)*$1+0.0211410061)*$1+0.049867347)*$1+1),-16)/2
ELSE 1 - pnorm(-$1)
END;
$$ LANGUAGE SQL IMMUTABLE STRICT;
@raven44099
raven44099 / biogpt_230310.ipynb
Created March 10, 2023 06:29
BioGPT_230310.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# imports
import getpass
import os
from langchain import LLMChain
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate,
ChatPromptTemplate,
SystemMessagePromptTemplate,
AIMessagePromptTemplate,
# imports
import getpass
import os
from langchain import LLMChain
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate,
ChatPromptTemplate,
SystemMessagePromptTemplate,
HumanMessagePromptTemplate
@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains