Skip to content

Instantly share code, notes, and snippets.

@op183
op183 / Sir.swift
Last active April 4, 2020 23:55
SIR
//
// Sir.swift
// corona
//
// Created by Ivo Vacek on 02/04/2020.
// Copyright © 2020 Ivo Vacek. All rights reserved.
//
import Foundation
@op183
op183 / ContentView.swift
Last active March 10, 2020 22:41
example of custom binding
//
// ContentView.swift
// tmp073
//
// Created by Ivo Vacek on 03/03/2020.
// Copyright © 2020 Ivo Vacek. All rights reserved.
//
import SwiftUI
struct UnitPicker: View {
import SwiftUI
struct FullWidthImageView: View {
@ObservedObject var model = modelStore
var body: some View {
VStack {
Image(systemName: model.img)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200)
@op183
op183 / main.swift
Last active February 2, 2021 17:53
echod echo tcp/udp server with TLS-PSK support, using apple Network.framework
//
// main.swift
// echod
//
// Created by Ivo Vacek on 27/12/2018.
// Copyright © 2018 Ivo Vacek. All rights reserved.
//
import Network
import Foundation
@op183
op183 / main.swift
Last active July 2, 2022 03:48
Echo UDP Server written in pure Swift
import Darwin
import Dispatch
class EchoUDPServer {
// syncQueue help us print and read/write safely from our internal storage
// while running, the main queue is blocking with readLine()
private let syncQueue = DispatchQueue(label: "syncQueue")
@op183
op183 / main.swift
Last active May 14, 2017 20:20
Multi-Client EchoServer written in pure Swift
//
// main.swift
// echoCLI
//
// Created by Ivo Vacek on 13/05/2017.
// Copyright © 2017 Ivo Vacek. All rights reserved.
//
// Minimalistic Multi-Client EchoServer written in Swift
//
public class Rabbit {
typealias Vect = (UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32, UInt32)
static let vect0: Vect = (0,0,0,0,0,0,0,0)
typealias State = (x: Vect, c: Vect, carry: UInt32)
static let state0: State = (x: vect0, c: vect0, carry: 0)
public typealias Key = (UInt32, UInt32, UInt32, UInt32)
public static let key0: Key = (0,0,0,0)
public typealias IV = (UInt32,UInt32)
@op183
op183 / Json.swift
Created January 2, 2016 20:59
very simple JSON written in pure Swift
//
// Json.swift
// BotWaRz
//
// Created by Ivo Vacek on 06/10/15.
// Copyright © 2015 Ivo Vacek. All rights reserved.
//
// enum doesn't support stored properties !!!