This file contains 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 anthropic_bedrock | |
from anthropic_bedrock import AnthropicBedrock | |
aws_access_key = os.getenv('AWS_ACCESS_KEY') | |
aws_secret_key = os.getenv('AWS_SECRET_KEY') | |
abclient = AnthropicBedrock( | |
# Authenticate by either providing the keys below or use the default AWS credential providers, such as | |
# using ~/.aws/credentials or the "AWS_SECRET_ACCESS_KEY" and "AWS_ACCESS_KEY_ID" environment variables. | |
aws_access_key=aws_access_key, |
This file contains 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 anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT | |
anthropic_api_key = os.getenv('ANTHROPIC_API_KEY_1') | |
anthropic = Anthropic(api_key=anthropic_api_key) | |
def get_anthropic_completion(prompt, model="claude-2.1"): | |
completion = anthropic.completions.create( | |
model=model, | |
max_tokens_to_sample=1000, | |
temperature=0.2, |
This file contains 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 | |
perplexity_api_key = os.getenv('PERPLEXITY_API_KEY_1') | |
purl = "https://api.perplexity.ai/chat/completions" | |
pheaders = { | |
"accept": "application/json", | |
"authorization": f'Bearer {perplexity_api_key}', | |
"Content-Type": "application/json" | |
} |
This file contains 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 openai | |
openai.api_key = os.getenv('OPENAI_API_KEY_1') | |
def get_open_ai_completion(prompt, model="gpt-3.5-turbo"): | |
messages = [{"role": "user", "content": prompt}] | |
open_ai_response = openai.ChatCompletion.create( | |
model=model, | |
messages=messages, | |
temperature=0.2, |
This file contains 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
# Setup commands you'll need to configure the environment | |
conda activate ~/opt/anaconda3 | |
~/opt/anaconda3/bin/conda install -p ~/opt/anaconda3 anthropic -y | |
pip install anthropic | |
pip install ai21 | |
pip install openai | |
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" | |
sudo installer -pkg AWSCLIV2.pkg -target / |
This file contains 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
#pragma mark - Article: https://sergey-nes.medium.com/enhance-your-swiftui-live-preview-workflow-with-previewlogger-6c768e7362a5 | |
import SwiftUI | |
#pragma mark - ContentView | |
struct ContentView: View { | |
@EnvironmentObject var previewLogger: PreviewLogger | |
var body: some View { |
This file contains 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
//first | |
dispatch_async(queue, ^{ | |
dispatch_group_t group1 = dispatch_group_create(); | |
// Tasks goes here | |
for (NSInteger i = 0; i < 3; i++) { |
This file contains 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 ApiBuilder from "claudia-api-builder"; | |
import fetch from "node-fetch"; | |
import FormData from "form-data"; | |
let api = new ApiBuilder(); | |
const verifyAndroidReceipt = req => { | |
// setup credentials | |
const config = { | |
client_id: "<fill in>", |
This file contains 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
fun done() { onAction(ListScreenActions.OnDone(state()))} | |
fun save(runBefore: () -> Unit) { | |
onAction(ListScreenActions.OnSave(state()), runBefore = runBefore) | |
} | |
fun backToPrevState() { | |
state().back?.let { | |
screenState.value = it | |
} |
This file contains 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
fun selectedRow(runAfter: () -> Unit) { | |
onAction(ListScreenActions.OnSelectRow, runAfter = runAfter) | |
} | |
fun editSelectedRow(){ onAction(ListScreenActions.OnSelectedRowChanged) } |
NewerOlder