Spaces:
Running
Running
vinhnx90
commited on
Commit
•
be63200
0
Parent(s):
Liftoff
Browse files- .gitignore +160 -0
- LICENSE +21 -0
- apikey.py +1 -0
- app.py +143 -0
- requirements.txt +6 -0
- sample/101.txt +104 -0
.gitignore
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/#use-with-ide
|
110 |
+
.pdm.toml
|
111 |
+
|
112 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
113 |
+
__pypackages__/
|
114 |
+
|
115 |
+
# Celery stuff
|
116 |
+
celerybeat-schedule
|
117 |
+
celerybeat.pid
|
118 |
+
|
119 |
+
# SageMath parsed files
|
120 |
+
*.sage.py
|
121 |
+
|
122 |
+
# Environments
|
123 |
+
.env
|
124 |
+
.venv
|
125 |
+
env/
|
126 |
+
venv/
|
127 |
+
ENV/
|
128 |
+
env.bak/
|
129 |
+
venv.bak/
|
130 |
+
|
131 |
+
# Spyder project settings
|
132 |
+
.spyderproject
|
133 |
+
.spyproject
|
134 |
+
|
135 |
+
# Rope project settings
|
136 |
+
.ropeproject
|
137 |
+
|
138 |
+
# mkdocs documentation
|
139 |
+
/site
|
140 |
+
|
141 |
+
# mypy
|
142 |
+
.mypy_cache/
|
143 |
+
.dmypy.json
|
144 |
+
dmypy.json
|
145 |
+
|
146 |
+
# Pyre type checker
|
147 |
+
.pyre/
|
148 |
+
|
149 |
+
# pytype static type analyzer
|
150 |
+
.pytype/
|
151 |
+
|
152 |
+
# Cython debug symbols
|
153 |
+
cython_debug/
|
154 |
+
|
155 |
+
# PyCharm
|
156 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
157 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
158 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160 |
+
#.idea/
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2024 Vinh Nguyen
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
apikey.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
openai_api_key = ""
|
app.py
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
from langchain.chat_models import ChatOpenAI
|
5 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
7 |
+
from langchain.vectorstores.chroma import Chroma
|
8 |
+
from langchain.chains import ConversationalRetrievalChain
|
9 |
+
from langchain.document_loaders import (
|
10 |
+
PyPDFLoader,
|
11 |
+
Docx2txtLoader,
|
12 |
+
TextLoader,
|
13 |
+
)
|
14 |
+
|
15 |
+
from apikey import openai_api_key
|
16 |
+
|
17 |
+
os.environ["OPENAI_API_KEY"] = openai_api_key
|
18 |
+
|
19 |
+
|
20 |
+
def load_and_process_file(file_data):
|
21 |
+
"""
|
22 |
+
Load and process the uploaded file.
|
23 |
+
Returns a vector store containing the embedded chunks of the file.
|
24 |
+
"""
|
25 |
+
file_name = os.path.join("./", file_data.name)
|
26 |
+
with open(file_name, "wb") as f:
|
27 |
+
f.write(file_data.getvalue())
|
28 |
+
|
29 |
+
name, extension = os.path.splitext(file_name)
|
30 |
+
|
31 |
+
# Load the file using the appropriate loader
|
32 |
+
if extension == ".pdf":
|
33 |
+
loader = PyPDFLoader(file_name)
|
34 |
+
elif extension == ".docx":
|
35 |
+
loader = Docx2txtLoader(file_name)
|
36 |
+
elif extension == ".txt":
|
37 |
+
loader = TextLoader(file_name)
|
38 |
+
else:
|
39 |
+
st.write("This document format is not supported!")
|
40 |
+
return None
|
41 |
+
|
42 |
+
documents = loader.load()
|
43 |
+
|
44 |
+
text_splitter = RecursiveCharacterTextSplitter(
|
45 |
+
chunk_size=1000,
|
46 |
+
chunk_overlap=200,
|
47 |
+
)
|
48 |
+
chunks = text_splitter.split_documents(documents)
|
49 |
+
|
50 |
+
embeddings = OpenAIEmbeddings()
|
51 |
+
vector_store = Chroma.from_documents(chunks, embeddings)
|
52 |
+
|
53 |
+
return vector_store
|
54 |
+
|
55 |
+
|
56 |
+
def initialize_chat_model(vector_store):
|
57 |
+
"""
|
58 |
+
Initialize the chat model with the given vector store.
|
59 |
+
Returns a ConversationalRetrievalChain instance.
|
60 |
+
"""
|
61 |
+
llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
|
62 |
+
retriever = vector_store.as_retriever()
|
63 |
+
return ConversationalRetrievalChain.from_llm(llm, retriever)
|
64 |
+
|
65 |
+
|
66 |
+
def main():
|
67 |
+
"""
|
68 |
+
The main function that runs the Streamlit app.
|
69 |
+
"""
|
70 |
+
st.set_page_config(page_title="Chat with Document", page_icon="📚")
|
71 |
+
|
72 |
+
st.title("📚 Chat with Document")
|
73 |
+
st.write("Upload a document and ask questions related to its content.")
|
74 |
+
|
75 |
+
uploaded_file = st.file_uploader(
|
76 |
+
"Upload a file", type=["pdf", "docx", "txt"], key="file_uploader"
|
77 |
+
)
|
78 |
+
add_file = st.button(
|
79 |
+
"Process File",
|
80 |
+
on_click=clear_history,
|
81 |
+
key="process_button",
|
82 |
+
)
|
83 |
+
|
84 |
+
if uploaded_file and add_file:
|
85 |
+
with st.spinner("Processing file..."):
|
86 |
+
vector_store = load_and_process_file(uploaded_file)
|
87 |
+
if vector_store:
|
88 |
+
crc = initialize_chat_model(vector_store)
|
89 |
+
st.session_state.crc = crc
|
90 |
+
st.success("File processed successfully!")
|
91 |
+
|
92 |
+
st.markdown("## Ask a Question")
|
93 |
+
question = st.text_area("Enter your question", height=200, key="question_input")
|
94 |
+
submit_button = st.button("Submit", key="submit_button")
|
95 |
+
|
96 |
+
if submit_button and "crc" in st.session_state:
|
97 |
+
handle_question(question)
|
98 |
+
|
99 |
+
display_chat_history()
|
100 |
+
|
101 |
+
|
102 |
+
def handle_question(question):
|
103 |
+
"""
|
104 |
+
Handles the user's question by generating a response and updating the chat history.
|
105 |
+
"""
|
106 |
+
crc = st.session_state.crc
|
107 |
+
if "history" not in st.session_state:
|
108 |
+
st.session_state["history"] = []
|
109 |
+
|
110 |
+
with st.spinner("Generating response..."):
|
111 |
+
response = crc.run(
|
112 |
+
{
|
113 |
+
"question": question,
|
114 |
+
"chat_history": st.session_state["history"],
|
115 |
+
}
|
116 |
+
)
|
117 |
+
|
118 |
+
st.session_state["history"].append((question, response))
|
119 |
+
st.write(response)
|
120 |
+
|
121 |
+
|
122 |
+
def display_chat_history():
|
123 |
+
"""
|
124 |
+
Displays the chat history in the Streamlit app.
|
125 |
+
"""
|
126 |
+
if "history" in st.session_state:
|
127 |
+
st.markdown("## Chat History")
|
128 |
+
for q, a in st.session_state["history"]:
|
129 |
+
st.markdown(f"**Question:** {q}")
|
130 |
+
st.write(a)
|
131 |
+
st.write("---")
|
132 |
+
|
133 |
+
|
134 |
+
def clear_history():
|
135 |
+
"""
|
136 |
+
Clear the chat history stored in the session state.
|
137 |
+
"""
|
138 |
+
if "history" in st.session_state:
|
139 |
+
del st.session_state["history"]
|
140 |
+
|
141 |
+
|
142 |
+
if __name__ == "__main__":
|
143 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
langchain
|
3 |
+
chromadb
|
4 |
+
openai
|
5 |
+
tiktoken
|
6 |
+
pypdf
|
sample/101.txt
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 years ago, I started my freshman year of college. This is the advice I needed to hear, not the advice you need to hear. In fact, some of it may be actively bad for you. See Should you reverse any advice you hear?
|
2 |
+
You are overly obedient. You not only do what people tell you to do, but find it hard to imagine any world other than the one they present to you. Spend more time thinking about what you want, in isolation from the pressures of the world. (Keep this in mind while you read the rest of this very prescriptive document.)
|
3 |
+
Fortunately, you’re usually able to recognize and extricate yourself from situations that are bad for you. Unfortunately, it often takes you about twice as long as it should.
|
4 |
+
There will be quiet periods of your life. They will feel slow and low in potential energy. The best use of them is to work on cool projects and share them.
|
5 |
+
Write more, on the internet, in college and after. Not only will it increase your surface area of luck, it will also help you form a better idea of who you are.
|
6 |
+
Don't do things that feel bad. This is not as easy as it sounds, because you are a two-marshmallow kid.
|
7 |
+
Ideally, you wouldn't drink at all. Since we both know it is impossible, try to keep it to once a week.
|
8 |
+
When you are bored at work, don't snack. Instead, go outside for a walk in the sun.
|
9 |
+
New York is an extremely hedonistic place, especially for a young professional. You'll eat, drink and party too much. It will be fun, and you will be correct in feeling that there is more to life than this.
|
10 |
+
Despite what you think, money is not the constraining factor on your ability to do things. If I had to guess what it is, it's probably your social environment (your friends and mentors) and your creativity.
|
11 |
+
Do a quantitative trading internship. Despite the fact that the trading interns seem obnoxious and scary, they are not smarter or better than you.
|
12 |
+
You currently have high intelligence and low agency. Be aware that you are naturally drawn to people like you, but where possible, try to find and spend time with intelligent people who have high agency.
|
13 |
+
Join an a capella or dance group in college.
|
14 |
+
You are right to be suspicious of Big EA.
|
15 |
+
Despite what the Europeans will tell you, finance is a fine discipline, and you should become an expert in it. It is the system of money, and it is interesting and well worth knowing for that reason.
|
16 |
+
Everybody in finance has a number. For almost everybody that number goes up over time. What makes you think it'll be different for you?
|
17 |
+
You dream of living in a sunny home where you can go downstairs and get a coffee at a cute shop around the corner. You are correct that this will make you happy.
|
18 |
+
You like Brooklyn brownstone apartments more than fancy luxury apartments because they are in point access blocks and have windows on two sides.
|
19 |
+
Live in the same neighbourhood as your friends.
|
20 |
+
Few experiences are as joyful as cycling around a beautiful city on a sunny day.
|
21 |
+
At some point, you will face a choice between work and the love of your life. Pick the boy.
|
22 |
+
At some point, the love of your life will face a choice between work and you. If he doesn't pick you, dump him.
|
23 |
+
Don't fall in love with something that can't love you back. Companies do not spend a week crying when you break up with them. This is also true of many boys.
|
24 |
+
People will occasionally make unsolicited, snide and rude comments to you. Ignore them; this is usually a sign that they are deeply insecure. If they are in a position of authority over you, get away from them.
|
25 |
+
You are more inclined to exit than to voice. It is better to do one than neither, but know that leaving is always expensive.
|
26 |
+
You are not direct enough when criticizing people.
|
27 |
+
You get angry when the world is unjust. At some point, you will be taught that it is never okay to show it. That's the wrong lesson, though a common one for young women. The right one is that you shouldn't spend time around people who don't understand and appreciate why you are angry.
|
28 |
+
You also become angry and sad because you let people push past your boundaries. Stop letting them. Often, just saying 'no' is enough.
|
29 |
+
You are high in neuroticism, a trait that correlates with worse social relationships and an unhappier life. Sorry; there's not much you can do about it other than be aware of it. Its saving grace is that it means you are attuned to what is wrong in the world and driven to fix it.
|
30 |
+
At lot of your work will involve taking some flow in the world and optimizing some property of them: latency, throughput or bandwidth. To do this, you must figure out what limits them and then remove that bottleneck. This sounds simple, but you will not really understand the depth of this discipline until you work with a master of it.
|
31 |
+
Start tracking hours spent on deep work. It is an obvious and very visible metric of how much work you have done.
|
32 |
+
If you enjoy interning somewhere, but the person you like most announces during your internship that they're leaving the firm, think hard about what message you should take away from that.
|
33 |
+
The most important thing to consider when picking a job is who your manager and team will be. The company is only important insofar as it interferes with or supports your ability to work with your team. Conveniently, the most prestigious and well-known companies are the best at getting out of your way.
|
34 |
+
A $25 Airtag will save you 10 minutes a day of looking for your wallet.
|
35 |
+
Sometimes, you will worry that things feel too pleasant and stable and that you are in a rut. Don't worry; something will jolt you out of it eventually. Enjoy the good parts while they last.
|
36 |
+
Status exists in all domains. Status in areas you don't care about is useless and mind-corroding. The best way to accumulate it in areas you care about is by doing cool things.
|
37 |
+
Nerd cultures have status dynamics, too. In fact, they are often stronger there because there are few defenses against it.
|
38 |
+
Your inbound opportunities are worse than the ones you carefully select and nurture over time. This is true both if you are an engineer looking for a job and if you are a 19-year-old girl looking for someone to date.
|
39 |
+
Be suspicious of people who fawn over you with affection for no reason. They usually have a system for finding people like you, and they will grind you up in the cogs of their machine. This is true both if you are an engineer looking for a job and if you are a 19-year-old girl looking for someone to date.
|
40 |
+
It is not bad to be in a transactional relationship as long as you get something out of it.
|
41 |
+
Help people. Some of them may not remember, but you will feel good about doing it anyway. Some of them will, and it will create a strong bond between you.
|
42 |
+
When you are in college, there are so many potential friends around that it is correct to filter out people who are hard to contact. Once you are older, this becomes much less true.
|
43 |
+
The best reason to move to New York is because all your friends are moving there too.
|
44 |
+
The best way to make friends is by working on a large and intense project together. This could be a conference, a camp or a startup.
|
45 |
+
Try to visit a nice, suburban house of an American friend during college. You will not understand the country until you do this.
|
46 |
+
Learn to drive, as soon as possible.
|
47 |
+
Being on an F-1 visa does not constrain your ability to work on a startup.
|
48 |
+
In 2020 and 2021, mass hysteria will sweep the world. (There will be a virus, too, but since you are a healthy 25-year-old and don't know any over 50, it will not notably affect your life.) Realize that nobody at any large company will get any work done during this time. Don't throw effort into work during this time, or you will burn out.
|
49 |
+
Stick it out to get your 2020 bonus, then seriously consider leaving your job and moving into crypto. It's a degenerate and trash subculture, but it's one of the only high-agency environments you have access to in 2020 and 2021. If you don't do that, at least switch teams.
|
50 |
+
For the love of God, buy Solana at $3.
|
51 |
+
You will be deeply unhappy in any job that requires you to sit in a windowless box from 9-5 all day. Fortunately, very few good jobs require this.
|
52 |
+
You should aim to produce things at about a 1:10 ratio to how much you consume them. This is true of food, videos, internet comments and parties. Realistically, you might achieve 1:100 or 1:1000.
|
53 |
+
Get into the habit of making mid-term or long-term stock bets of about .5-1% of your net worth. This will never make you rich, but it will inform you about how much you know relative to the rest of the world.
|
54 |
+
100% VOO, after an emergency fund, is a fine allocation of savings for a young professional with no family obligations. Interactive Brokers will let you borrow against it on margin if you need temporary liquidity on short notice.
|
55 |
+
Most advice is given by and directed at people who have less education, money, technical ability, and social capital than you. You should consider it accordingly. Do note that I have more of all of those things than you.
|
56 |
+
Don't trust people when they say that they are experts and they know what they are doing. Ask the questions you need to ask to understand at least the high level of what is going on.
|
57 |
+
People who lie to you about small and unimportant things will lie to you about big and important things.
|
58 |
+
Most managers lie.
|
59 |
+
Mathcamp is a strangely good selector for people you like. You should not spend 100% of your time with Mathcampers, but 10-30% is a good ratio.
|
60 |
+
Avoid makeup. Wear imported Korean sunscreen every day.
|
61 |
+
Take a week off every year and go to Burning Man. It will change your conception of what is possible in the physical world.
|
62 |
+
You will understand a person when you understand what it is that they want most in life.
|
63 |
+
Get a coach to teach you proper form, then lift weights 2-3 times a week. That is all you need to do to stay healthy.
|
64 |
+
Try very hard not to gain weight. Once it goes on, it is hard to take off.
|
65 |
+
Grow a garden. It will teach you about patience and consistency. It will also teach you about the value of automation, and a useful amount about plumbing.
|
66 |
+
Programming is not the only technical skill worth knowing.
|
67 |
+
Spend lots of time posting thoughts in good group chats. A tight-knit Discord server is great for this, but it is hard to kickstart.
|
68 |
+
People will tell you that it is good and right to be Scotty. They are wrong; you should be like Kirk.
|
69 |
+
Do some wet lab biology work in college. Also, take a campus job that requires you to do sales.
|
70 |
+
Take only one hard class a semester. Really. You'll learn more, have a better time and get really good grades.
|
71 |
+
Professors are extremely variable in quality.
|
72 |
+
Start trying to understand the world through Fermi calculations. Memorize important numbers. This is an extremely useful skill.
|
73 |
+
Try to make ambitious and smart friends who do cool things. The best way to do so is to be smart and ambitious yourself, and do cool things.
|
74 |
+
It is important to do some on-call/production support, but you are very good at it and will be asked to do it more than others. Say no. It will take away from your ability to develop more valuable skills.
|
75 |
+
Every month, write an email to your friends around the world. This is the best way to stay in touch with people who you may not see again for years.
|
76 |
+
Bookmark and catalogue good essays on the internet.
|
77 |
+
Organize your cables by putting them into labeled ziploc bags. Put the ziploc bags in a box and label it 'cables'. Now you will have a cleaner desk cabinet and infinite cables.
|
78 |
+
The best work comes out of great teams.
|
79 |
+
You will never live in Europe. That's OK; it is better to visit than to live there.
|
80 |
+
Asia is not a good place for software engineers.
|
81 |
+
Run essays through Grammarly before you publish them.
|
82 |
+
Good work requires much more than just grinding. You need to be creative, well-connected and communicative, too.
|
83 |
+
You will learn the key parts of what can be generically taught about software engineering in a year and a half. There is much more to learn, but you will need to teach it to yourself or seek out specialized teachers.
|
84 |
+
People show you much of their character in the first few days you know them.
|
85 |
+
There is a part of you that will always rebel against the world you are a part of. Keep it alive; it's usually right.
|
86 |
+
When you are young, it feels like you will cycle through hobbies and ways of life quickly. Don't stress about it. At some point, you will slow down and develop a routine.
|
87 |
+
You are more like a plant than you realize. Drink lots of water and spend time in the sun.
|
88 |
+
If you find yourself spending a lot of time in the bathroom on your phone, it is because you work in a large, open-floor office all the time, and it's the only place you can get away from the chaos. Consider changing your lifestyle so that you don't need to do this.
|
89 |
+
You work better and feel happier immediately after you drink coffee. You will crash a few hours later. A pill of tyrosine can do wonders in the mid-afternoon.
|
90 |
+
Avoid carbs and eat lots of protein.
|
91 |
+
You only need three pots and pans in your kitchen: a wok, a cast-iron pan, and a Dutch oven.
|
92 |
+
You cannot work and travel at the same time. Don't try.
|
93 |
+
Hang out with your friends at least three or four times a week. Best if it's every day.
|
94 |
+
You don't need to be in your employer's office to do good work. You will feel great if you spend your days working in a room with your friends, even if they're working on something completely different.
|
95 |
+
Don't work with people who you don't technically respect. If your employer keeps insisting that you do, quit.
|
96 |
+
The best way for you to be happy with your work is to control who you work with. The way you do this is by deciding who your team hires and fires.
|
97 |
+
Consider deleting as often as you consider adding. This holds true for code, furniture and obligations.
|
98 |
+
The trick to surviving a big institution is to find your group within it. Then ignore everything else.
|
99 |
+
American culture, despite many words to the contrary, is built around self-segregation. You will be happier once you stop fighting this.
|
100 |
+
In college, try to make a cool app that all your friends want to use.
|
101 |
+
I would trade half my current net worth for a world in which I had a stronger community of friends and had worked more on my own projects instead of someone else's. Consider that when you make your choices, on the margin.
|
102 |
+
The next decade of your life will be a rollercoaster, but it will also amazing. You will make friends who will become family, find the love of your life and get really good at your craft. I wouldn't swap places with you. But I've had a great ride and I hope the next decade of my life is as good.
|
103 |
+
|
104 |
+
# credit: https://www.approachwithalacrity.com/101-things-for-my-past-self/
|