Skip to content

Instantly share code, notes, and snippets.

View sebsto's full-sized avatar

Sébastien Stormacq sebsto

View GitHub Profile
@sebsto
sebsto / swift.md
Created June 23, 2025 14:45
Amazon Q Context for Swift projects

You are a coding assistant--with access to tools--specializing in analyzing codebases. Below is the content of the file the user is working on. Your job is to to answer questions, provide insights, and suggest improvements when the user asks questions.

Do not answer with any code until you are sure the user has provided all code snippets and type implementations required to answer their question.

Briefly--in as little text as possible--walk through the solution

@sebsto
sebsto / helper.swift
Created April 1, 2025 17:25
MCP swift-SDK wrapper
import MCP
#if canImport(FoundationEssentials)
import FoundatioNEssentials
#else
import Foundation
#endif
public protocol MCPTool<Input, Output>: Sendable {
associatedtype Input
@sebsto
sebsto / gist:5a8b9e763190057dcb90c7a83d5a05eb
Created October 29, 2024 16:02
Install Xcode from the command line
#!/bin/sh
echo "==========================="
echo "Installing required tools"
echo "==========================="
echo "Checking the current version of XCode"
xcode_version=$(xcodebuild -version)
echo $xcode_version
if [[ ${xcode_version} != *"$XCODE_REQUIRED_VERSION"* ]];then
echo "Build requires Xcode version $XCODE_REQUIRED_VERSION - upgrading now"
@sebsto
sebsto / gist:6409ed9dbf4c9dd1488e049165f751aa
Last active November 21, 2024 02:55
Build Swift 6.x on Amazon Linux 2023
#!/bin/bash
## Install and Remove conflicting dependencies
sudo dnf install python3-pip -y
sudo dnf remove python3-requests python-urllib3 -y
## Install docker (used by swift-installer-script project)
sudo dnf install docker -y
@sebsto
sebsto / assume_root_credentials.sh
Last active June 9, 2025 18:25
Assume Root on AWS member accounts
#!/bin/bash
AWS_ACCOUNT_ID=012345678901
# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. Please install jq to parse JSON."
exit 1
fi
@sebsto
sebsto / gist:a6c2346eaa72bb9cc4b061b20b56cfcc
Last active February 27, 2025 15:37
Build Swift 5.8 or 5.9 on Amazon Linux 2023
#!/bin/bash
## Install and Remove conflicting dependencies
sudo dnf install python3-pip -y
sudo dnf remove python3-requests python-urllib3 -y
## Install LD GOLD
sudo dnf install gmp-devel mpfr-devel texinfo bison git gcc-c++ -y
mkdir ld.gold && cd ld.gold
@sebsto
sebsto / install_ld.gold.sh
Last active October 2, 2024 17:14
Installl `ld.gold` on Amazon Linux 2023
#!/bin/bash
dnf install gmp-devel mpfr-devel texinfo bison git gcc-c++ -y
mkdir ld.gold && cd ld.gold
git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils
mkdir build && cd build
../binutils/configure --enable-gold --enable-plugins --disable-werror
make all-gold
cd gold
@sebsto
sebsto / bedrock_cohere_embed.swift
Last active November 13, 2023 12:49
Example of code to invoke Cohere Embed model on Amazon Bedrock in the Swift programming language
import Foundation
import ClientRuntime
// reduce the verbosity of the AWS SDK
SDKLoggingSystem.initialize(logLevel: .warning)
import AWSBedrock
import AWSBedrockRuntime
// create a Bedrock client and list available models for a provider
@sebsto
sebsto / shell.sh
Last active October 30, 2023 22:08
AWS Amazon EC2 Mac : find macOS AMI IDs
# list all the AMIs for a major macOS version
REGION=us-east-1
MACOS_VERSION=14
aws ec2 describe-images \
--region $REGION \
--filters Name=name,Values="amzn-ec2-macos-$MACOS_VERSION*" \
--owners amazon \
--query 'Images[*].[Architecture,Description,ImageId]' \
--output text
@sebsto
sebsto / bedrock_llama2.swift
Created October 25, 2023 16:27
Example of code to invoke Llama 2 LLM on Amazon Bedrock in the Swift programming language
import Foundation
import ClientRuntime
// reduce the verbosity of the AWS SDK
SDKLoggingSystem.initialize(logLevel: .warning)
import AWSBedrock
import AWSBedrockRuntime
// create a Bedrock client and list available models for a provider