Skip to content

Instantly share code, notes, and snippets.

View finestructure's full-sized avatar

Sven A. Schmidt finestructure

View GitHub Profile
2024-07-22 07:19:36.471
2024-07-22 07:19:36.737
2024-07-22 07:21:12.021
*** Signal 4: Backtracing from 0x563b13828f50... done ***
2024-07-22 07:21:12.021
2024-07-22 07:21:12.021
*** Program crashed: Illegal instruction at 0x0000563b13828f50 ***
@finestructure
finestructure / test-build.sh
Last active July 13, 2024 13:28
Swift 6 preview test build
mkdir SwiftPackageIndex-Server && cd SwiftPackageIndex-Server
git init .
git remote add origin https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server
git fetch origin --depth=1 89cbad3846eaef877ec33925eca5867922cf391a
git reset --hard FETCH_HEAD
mkdir .stats
time env DEVELOPER_DIR=/Applications/Xcode-16.0.0-Beta.3.app xcrun swift build --arch arm64 -Xswiftc -Xfrontend -Xswiftc -stats-output-dir -Xswiftc -Xfrontend -Xswiftc .stats -Xswiftc -strict-concurrency=complete
❯ git rev-parse @
903d9ec992451cf80bf80cf82b82992fb331ccfb
~/P/S/spi-server on swift-6-prep
❯ swift package clean
~/P/S/spi-server on swift-6-prep
❯ swift build --build-tests
Building for debugging...
/Users/sas/Projects/SPI/spi-server/.build/checkouts/swift-certificates/Sources/X509/Signature.swift:16:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module '_CryptoExtras'
import _CryptoExtras
^
@finestructure
finestructure / list-toolchains.swift
Last active March 26, 2024 10:39
List Swift toolchain IDs
#!/usr/bin/env swift
import Foundation
let toolchainsDir = URL(fileURLWithPath: "/Library/Developer/Toolchains")
struct ToolchainInfoPlist: Codable {
var bundleIdentifier: String
var createdDate: Date
var displayName: String
@finestructure
finestructure / Dockerfile
Last active February 3, 2024 09:58
Pkl dockerfile
FROM swift:5.9-slim
RUN apt-get update && apt-get -y install curl fish
ARG PKL_VERSION=0.25.1
RUN curl -L -o /usr/local/bin/pkl https://github.com/apple/pkl/releases/download/${PKL_VERSION}/pkl-linux-aarch64 && chmod +x /usr/local/bin/pkl
# requires Swift runtime libraries, that's why the base image is swift:5.9-slim
ARG PKL_GEN_SWIFT_VERSION=0.2.1
RUN curl -L -o /usr/local/bin/pkl-gen-swift https://github.com/apple/pkl-swift/releases/download/${PKL_GEN_SWIFT_VERSION}/pkl-gen-swift-linux-aarch64.bin && chmod +x /usr/local/bin/pkl-gen-swift
@finestructure
finestructure / ci.yml
Last active December 11, 2023 11:52
Github CI setup
name: CI
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
@finestructure
finestructure / daws-test hang
Created December 8, 2023 12:16
daws-test hang
```
❯ ./.build/debug/daws server
starting server...
running.
2023-12-08T13:09:21+0100 info WebSocketActors : channel=[IPv6]::1/::1:57175 op=handleWebsocketChannel(_:remoteNodeID:) [WebSocketActors] new client connection
```
```
❯ ./.build/debug/daws client
starting client...
#!/bin/sh
set -euo pipefail
# Set the paths to your Old/New Xcodes
OLD_XCODE="/Applications/Xcode-14.3.1.app"
NEW_XCODE="/Applications/Xcode-15.0.0.app" # To get build number
# Get New Xcode build number
OLD_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${OLD_XCODE}/Contents/Info.plist)
@discardableResult
func run<T>(_ operation: () async throws -> T,
defer deferredOperation: () async throws -> Void) async throws -> T {
do {
let result = try await operation()
try await deferredOperation()
return result
} catch {
try await deferredOperation()
throw error
@finestructure
finestructure / Charting.swift
Last active October 23, 2023 20:22
Swift playground example to create charts with a PDF export button
import SwiftUI
import Charts
import PlaygroundSupport
let spiData: [(package: String, fileCount: Int, mbSize: Int)] = [
(package: "swift-markdown-ui", fileCount: 3796, mbSize: 44),
(package: "Microya", fileCount: 414, mbSize: 4),
(package: "swift-url-routing", fileCount: 9430, mbSize: 101),