This file contains hidden or 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 Fluent | |
| import Vapor | |
| protocol CSVDecodable { | |
| associatedtype DTO: CSVDecodableDTO | |
| init(from: DTO) throws | |
| } | |
| protocol CSVDecodableDTO: Sendable { | |
| associatedtype Repository: CSVRepository<Self> |
This file contains hidden or 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 GoogleCloudKit | |
| extension GoogleCloudAPIRequest { | |
| public func withToken<GoogleCloudModel>( | |
| _ closure: @escaping (OAuthAccessToken) async throws -> GoogleCloudModel | |
| ) async throws -> GoogleCloudModel { | |
| guard | |
| let token = currentToken, | |
| let created = tokenCreatedTime, | |
| refreshableToken.isFresh(token: token, created: created) |
This file contains hidden or 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
| replace: XCTAssertNil\((.*)\) | |
| with: #expect($1 == nil) | |
| replace: XCTAssertNotNil\((.*)\) | |
| with: #expect($1 != nil) |
This file contains hidden or 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
| docker run --platform linux/x86_64 \ | |
| --name resurva-delete-manager-mysql \ | |
| -e MYSQL_ROOT_PASSWORD=password \ | |
| -e MYSQL_DATABASE=database \ | |
| -e MYSQL_USER=username \ | |
| -e MYSQL_PASSWORD=password \ | |
| -v .../some_dump.sql:/docker-entrypoint-initdb.d/dump.sql \ | |
| -p 3306:3306 \ | |
| -d mysql:5.7 |
This file contains hidden or 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 json | |
| import base64 | |
| from pyspx import sha2_128s | |
| import os | |
| # 48 bytes seed | |
| seed = "0123456789abcdef0123456789abcdef0123456789abcdef".encode('utf-8') | |
| public_key, secret_key = sha2_128s.generate_keypair(seed) |
This file contains hidden or 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
| /// The following algorithm recovers the prime factors of a modulus, given the public and private exponents. | |
| /// The algorithm is based on Fact 1 in [Boneh 1999]. | |
| static func calculatePrimeFactors(n: BigUInt, e: BigUInt, d: BigUInt) throws -> (p: BigUInt, q: BigUInt) { | |
| let k = (d * e) - 1 | |
| guard k & 1 == 0 else { | |
| throw RSAError.keyInitializationFailure | |
| } | |
| let t = k.trailingZeroBitCount, r = k >> t |
This file contains hidden or 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
| // Define function to compute NDVI | |
| function addNDVI(image) { | |
| return image.addBands(image.normalizedDifference(['B8', 'B4']).rename('ndvi')); | |
| } | |
| // Define function to filter and compute NDVI for a given year and region | |
| function processYearlyData(year, region) { | |
| var startDate = ee.Date.fromYMD(year, 4, 1); | |
| var endDate = ee.Date.fromYMD(year, 9, 30); |
This file contains hidden or 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
| class DummyTests: XCTestCase { | |
| var eventLoopGroup: EventLoopGroup! | |
| var serverChannel: Channel? | |
| var serverAddress: SocketAddress? | |
| override func setUpWithError() throws { | |
| eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) | |
| try startTestServer() | |
| } |