This file contains hidden or 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 colorsys | |
| import random | |
| import os | |
| # Define output directory | |
| output_dir = "School/Stanford_University/Programs/Leadership_Education_for_Aspiring_Physicians/Research/Color/Query" | |
| os.makedirs(output_dir, exist_ok=True) | |
| # Function to convert RGB values to hex | |
| def rgb_to_hex(rgb): |
This file contains hidden or 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 os | |
| import csv | |
| # Define input and output paths | |
| query_file_path = "/School/Stanford_University/Programs/Leadership_Education_for_Aspiring_Physicians/Research/Literature/Scholarly/Query/scholar_queries.csv" | |
| output_dir = "/School/Stanford_University/Programs/Leadership_Education_for_Aspiring_Physicians/Research/Literature/Scholarly/Results" | |
| os.makedirs(output_dir, exist_ok=True) | |
| # Fetch results using CrossRef API |
This file contains hidden or 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
| Types: deb | |
| URIs: https://debian.stanford.edu/ubuntu | |
| Suites: noble noble-proposed noble-updates noble-security noble-backports | |
| Components: main universe restricted multiverse | |
| Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg |
This file contains hidden or 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 binance.client import Client | |
| from datetime import datetime, timedelta | |
| import time | |
| # Set up Binance API credentials | |
| api_key = 'YOUR_BINANCE_API_KEY' | |
| api_secret = 'YOUR_BINANCE_API_SECRET' | |
| # Login to Binance | |
| client = Client(api_key, api_secret) |
This file contains hidden or 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 td.client import TDClient | |
| from datetime import datetime, timedelta | |
| import time | |
| # Set up TD Ameritrade API credentials | |
| consumer_key = 'YOUR_TD_AMERITRADE_CONSUMER_KEY' | |
| redirect_uri = 'YOUR_REDIRECT_URI' | |
| credentials_path = 'path_to_credentials.json' # Path where credentials will be stored | |
| # Login to TD Ameritrade |
This file contains hidden or 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 robin_stocks.robinhood as r | |
| import time | |
| from datetime import datetime, timedelta | |
| # Set up Robinhood API credentials | |
| username = 'your_robinhood_username' | |
| password = 'your_robinhood_password' | |
| # Login to Robinhood | |
| r.login(username, password) |
This file contains hidden or 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 ib_insync import * | |
| from datetime import datetime, timedelta | |
| import time | |
| # Set up Interactive Brokers connection | |
| ib = IB() | |
| ib.connect('127.0.0.1', 7497, clientId=1) # Modify port and clientId as necessary | |
| # Define the trading parameters | |
| symbol = 'GOOGL' |
This file contains hidden or 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 alpaca_trade_api as tradeapi | |
| import time | |
| from datetime import datetime, timedelta | |
| # Set up Alpaca API credentials | |
| API_KEY = 'your_api_key' | |
| API_SECRET = 'your_api_secret' | |
| BASE_URL = 'https://paper-api.alpaca.markets' # Use the paper trading API for testing | |
| # Initialize the Alpaca API |
This file contains hidden or 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
| # Load model directly | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-405B") | |
| model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3.1-405B") | |
| # Define a function to generate words based on sentiments | |
| def generate_words(sentiment, num_words): | |
| # Tokenize the sentiment text | |
| inputs = tokenizer.encode_plus( |
This file contains hidden or 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 fitz # PyMuPDF | |
| import re | |
| import torch | |
| from torch.utils.data import Dataset, DataLoader | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| from transformers import AdamW | |
| device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| def extract_text_from_pdf(pdf_path): |
NewerOlder