- Ubuntu 14.04, 16.04, or 16.10
- Open up terminal
- Install core deps:
sudo apt-get install clang libicu-dev git
| # Fast API | |
| ``` | |
| @router.get("/myExample") | |
| async def mySpecialAPI( | |
| session_id: UUID, | |
| input="Hello", | |
| ) -> StreamResponse: | |
| # Note: Don't write await we need a coroutine | |
| invoke = chain.ainvoke(..) |
| import gc | |
| import os | |
| import sys | |
| import psutil | |
| import threading | |
| import argparse | |
| import transformers | |
| import datasets | |
| import numpy as np | |
| import torch |
| extension AnyPublisher where Failure: Error { | |
| struct Subscriber: Sendable { | |
| fileprivate let send: @Sendable (Output) -> Void | |
| fileprivate let complete: @Sendable (Subscribers.Completion<Failure>) -> Void | |
| func send(_ value: Output) { self.send(value) } | |
| func send(completion: Subscribers.Completion<Failure>) { self.complete(completion) } | |
| } | |
| init(_ closure: (Subscriber) -> AnyCancellable) { |
| // | |
| // Vibration.swift | |
| // | |
| // Created by Yannick Stephan on 2020-11-21. | |
| // | |
| import UIKit | |
| import AudioToolbox | |
| enum VibrationService { |
| import Foundation | |
| extension URL { | |
| /// Initialize with a static string. | |
| /// | |
| /// If the `URL` cannot be formed with the string (for example, if the string contains characters that are illegal in a URL, or is an empty string), a precondition failure will trigger at runtime. | |
| init(staticString: StaticString) { | |
| guard let url = Self.init(string: String(describing: staticString)) else { | |
| preconditionFailure("'\(staticString)' does not represent a legal URL") | |
| } |
| import Foundation | |
| import Combine | |
| enum APIError: Error, LocalizedError { | |
| case unknown, apiError(reason: String) | |
| var errorDescription: String? { | |
| switch self { | |
| case .unknown: | |
| return "Unknown error" |
| enum Shortcuts: String { | |
| case refreshList = "com.vialyx.MVD.refresh_list" | |
| var identifier: String { | |
| return rawValue | |
| } | |
| var title: String { | |
| switch self { | |
| case .refreshList: |
| $ cd ~ # home directory で作業 | |
| $ sudo apt-get install clang libicu-dev libcurl4 | |
| $ wget https://swift.org/builds/swift-4.2-release/ubuntu1804/swift-4.2-RELEASE/swift-4.2-RELEASE-ubuntu18.04.tar.gz | |
| $ tar xvpf swift-4.2-RELEASE-ubuntu18.04.tar.gz | |
| $ export PATH=~/swift-4.2-RELEASE-ubuntu18.04/usr/bin:$PATH |