Skip to content

Instantly share code, notes, and snippets.

View sebsto's full-sized avatar

Sébastien Stormacq sebsto

View GitHub Profile
@sebsto
sebsto / gist:a6c2346eaa72bb9cc4b061b20b56cfcc
Last active February 17, 2024 20:23
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 February 17, 2024 09:01
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
@sebsto
sebsto / bedrock_claude.swift
Last active November 11, 2023 15:05
Example of code to invoke Claude v2 LLM on Amazon Bedrock in the Swift programming language
import Foundation
// reduce the verbosity of the AWS SDK
import ClientRuntime
SDKLoggingSystem.initialize(logLevel: .warning)
import AWSBedrock
import AWSBedrockRuntime
// create a Bedrock client and list available models for a provider
#!/bin/sh
###
### Payload script
###
CURRENT_USER=$(whoami)
echo "Hello from shell script as user: \"$CURRENT_USER\""
exit 0
@sebsto
sebsto / gist:d91b29a8017c5a0800aa668ac208a2c7
Created November 12, 2022 07:05
SwiftUI Loading Circle
// inspired by https://www.appcoda.com/swiftui-animation-basics-building-a-loading-indicator/
import SwiftUI
struct LoadingCircleView: View {
@State private var isLoading = false
var body: some View {
ZStack {
Circle()
@sebsto
sebsto / gist:b53e61c5c8cfc38ad87289dd089b8174
Created April 6, 2022 18:34
To mount an APS volume on Ubuntu
# build Fuse from the source
mkdir -pv ~/src && cd ~/src
git clone https://github.com/sgan81/apfs-fuse.git
cd apfs-fuse
git submodule init
git submodule update
mkdir build
cd build
@sebsto
sebsto / gist:6af5bf3acaf25c00dd938c3bbe722cc1
Last active February 27, 2024 14:01
Start VNCServer on Mac1 EC2 Instance
# YouTube (english) : https://www.youtube.com/watch?v=FtU2_bBfSgM
# YouTube (french) : https://www.youtube.com/watch?v=VjnaVBnERDU
#
# On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
#
ssh -i <your private key.pem> ec2-user@<your public ip address>
#
# On the Mac