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 PerfectCrypto | |
| func AES128Encryption(_ string: String, key: String) -> String? { | |
| guard let hashData = key.digest(.sha384) else { return nil } | |
| let hashKeyData:[UInt8] = hashData[0..<32].map {$0} | |
| let ivData:[UInt8] = hashData[32..<48].map {$0} | |
| let data:[UInt8] = string.utf8.map { $0 } | |
| guard let x = data.encrypt(.aes_128_cbc, key: hashKeyData, iv: ivData), | |
| let y = x.encode(.base64) else { | |
| return 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
| import Foundation | |
| #if os(OSX) | |
| func bash(command: String) -> String? { | |
| let task = Process() | |
| task.launchPath = "/bin/bash" | |
| task.arguments = ["-c", command] | |
| let o = Pipe() | |
| task.standardOutput = o | |
| task.launch() | |
| task.waitUntilExit() |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <time.h> | |
| #define max_water 3 | |
| #define max_food 3 | |
| int done = 0; | |
| int traveled = 0, thirst = 0, camel_tiredness = 0; |
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
| // swift-tools-version:4.0 | |
| // The swift-tools-version declares the minimum version of Swift required to build this package. | |
| import PackageDescription | |
| let package = Package( | |
| name: "Extest", | |
| products: [ | |
| // Products define the executables and libraries produced by a package, and make them visible to other packages. | |
| .library( |
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 Foundation | |
| public extension String { | |
| public func scanHex() -> UInt32? { | |
| var value = UInt32(0) | |
| #if os(Linux) | |
| if Scanner(string: self).scanHexInt(&value) { | |
| return value | |
| } else { | |
| return 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
| import Foundation | |
| public struct Person: Codable, Equatable { | |
| public var name = "" | |
| public var age = 0 | |
| public static func == (lhs: Person, rhs: Person) -> Bool { | |
| return lhs.name == rhs.name && lhs.age == rhs.age | |
| } | |
| } |
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 Foundation | |
| public struct Person { | |
| public var name = "" | |
| public var age = 0 | |
| } | |
| let rocky = Person(name: "rocky", age: 24) | |
| print(rocky) |
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 MySQL | |
| import PerfectThread | |
| #if os(Linux) | |
| import Glibc | |
| #else | |
| import Darwin | |
| #endif | |
| let mysql = MySQL() | |
| let lock = Threading.Lock() |
NewerOlder