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
# update_requirements.py | |
import requests | |
import re | |
from typing import List | |
def fetch_latest_version(package_name: str) -> str: | |
"""Fetch the latest version of a package from PyPI.""" | |
url = f"https://pypi.org/pypi/{package_name}/json" | |
try: | |
response = requests.get(url) |
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 pandas as pd | |
from neo4j import GraphDatabase | |
# Connect to Neo4j database | |
uri = "bolt://localhost:7687" | |
username = "neo4j" | |
password = "password" | |
driver = GraphDatabase.driver(uri, auth=(username, password)) | |
def create_book_nodes(tx, book_title, publisher, author_name, language, rating): |
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 os | |
os.environ["OPENAI_API_KEY"] = "sk-*" | |
from langchain.prompts import PromptTemplate | |
from langchain_neo4j import Neo4jGraph | |
from langchain_neo4j import GraphCypherQAChain | |
from langchain_openai import ChatOpenAI | |
os.environ["NEO4J_URI"] = os.getenv("NEO4J_URI", "bolt://localhost:7687") | |
os.environ["NEO4J_USERNAME"] = os.getenv("NEO4J_USERNAME", "neo4j") | |
os.environ["NEO4J_PASSWORD"] = os.getenv("NEO4J_PASSWORD", "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
#!/bin/bash | |
# Define environment variables | |
NEO4J_VERSION="4.4.12" # Specify the Neo4j version you want to use | |
CONTAINER_NAME="neo4j_container" | |
NEO4J_DATA_DIR="./neo4j_data" # Local directory for Neo4j data | |
NEO4J_IMPORT_DIR="./neo4j_import" # Local directory for import files | |
NEO4J_PASSWORD="password" # Set a password for the Neo4j admin user | |
# Create local directories if they do not exist |
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 subprocess | |
import pkg_resources | |
import requests | |
from tabulate import tabulate | |
def get_installed_version(package): | |
try: | |
# Fetch the installed version of the package | |
return pkg_resources.get_distribution(package).version | |
except pkg_resources.DistributionNotFound: |
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 os | |
import sys | |
def timeConversion(s): | |
# | |
# Write your code here. | |
# | |
time = s.split(':') | |
if s[-2:] == "PM": |
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
int birthdayCakeCandles(vector<int> ar) { | |
int max = ar[0]; | |
int count = 0; | |
int n = ar.size(); | |
for(int i=0;i<n; i++) { | |
if(ar[i] > max) { | |
max = ar[i]; | |
} |
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
def birthdayCakeCandles(ar): | |
count = 0 | |
maxHeight = max(ar) | |
for i in ar: | |
if i == maxHeight: | |
count += 1 | |
return count |
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
#!/bin/python3 | |
def miniMaxSum(arr): | |
# Write your code here | |
sum = 0 | |
for element in arr: | |
sum += element | |
print(sum - max(arr), sum - min(arr)) | |
if __name__ == '__main__': |
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
void miniMaxSum(vector<int> arr) { | |
long long min = LLONG_MAX , max = LLONG_MIN , sum ; | |
for(int i = 0 ;i < arr.size() ; ++i) | |
{ | |
sum = 0; | |
for(int j = 0; j < arr.size() ; ++j) | |
{ | |
if(i != j) | |
sum += arr[j]; |
NewerOlder