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
| package com.jabbott.d288.entities; | |
| import jakarta.persistence.Column; | |
| import jakarta.persistence.Embeddable; | |
| import lombok.AllArgsConstructor; | |
| import lombok.Getter; | |
| import lombok.NoArgsConstructor; | |
| import lombok.Setter; | |
| import java.io.Serializable; |
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
| package com.jabbott.d288.entities; | |
| import jakarta.persistence.*; | |
| import lombok.Getter; | |
| import lombok.Setter; | |
| import org.hibernate.annotations.CreationTimestamp; | |
| import org.hibernate.annotations.UpdateTimestamp; | |
| import java.util.Date; | |
| import java.util.Set; |
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
| package com.jabbott.fsas.entity; | |
| import jakarta.persistence.*; | |
| import lombok.Data; | |
| import org.hibernate.annotations.CreationTimestamp; | |
| import org.hibernate.annotations.UpdateTimestamp; | |
| import java.math.BigDecimal; | |
| import java.util.Date; | |
| @Entity |
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 fastapi import FastAPI, HTTPException, Header, Depends | |
| import ollama | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() # Load environment variables from .env file | |
| API_KEY_CREDITS = {os.getenv('API_KEY'): 5} # Example: Each API key starts with 5 credits | |
| app = FastAPI() # Create FastAPI app instance |
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 | |
| try: | |
| response = requests.get(url='https://jsonplaceholder.typicode.com/invalid_endpoint', timeout=5) # Intentionally incorrect URL to trigger an error | |
| response.raise_for_status() # Raise an error for bad responses (4xx and 5xx) | |
| print('Success', response.json()) | |
| except requests.exceptions.Timeout: # Handle timeout exception | |
| print('The request timed out') | |
| except requests.exceptions.RequestException as e: # Catch all other request-related errors | |
| print('An error occurred:', e) |
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 | |
| token = 'your_api_token_here' # Replace with your actual token | |
| base_url = 'https://api.example.com/data' # Replace with the actual API endpoint | |
| headers = { | |
| 'Authorization': f'Bearer {token}' | |
| } | |
| response = requests.get(base_url, headers=headers) # Send GET request with authorization header |
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 uvicorn # webserver for FastAPI | |
| if __name__ == "__main__": | |
| uvicorn.run("app:app", host="0.0.0.0", port=8000, reload=True) # app.app:app refers to app folder, app.py file, and app variable |
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
| use std::io; | |
| use std::io::BufRead; | |
| // f64 is a data type that represents a 64-bit floating point number | |
| fn main() { | |
| println!("Tip Calculator"); | |
| // Get user input for total bill | |
| println!("What is the total bill? $"); | |
| let mut bill = String::new(); |
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
| use std::io::BufRead; | |
| fn main() { | |
| println!("Odd or Even Check"); | |
| println!("Please enter a number: "); | |
| // Get user input | |
| let mut userdata = String::new(); | |
| std::io::stdin() | |
| .read_line(&mut userdata) | |
| .expect("Failed to read line"); |
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
| [workspace] | |
| members = [ | |
| "basic_variable", | |
| "basic_calc", | |
| "basic_if", | |
| "basic_if_2", | |
| "basic_if_3", | |
| "basic_odd_vs_even", | |
| "cli_ls", | |
| ] |
NewerOlder