AnnexB format:
([start code] NALU) | ( [start code] NALU) |
AVCC format:
([extradata]) | ([length] NALU) | ([length] NALU) |
''' | |
Connect to an existing, ADB forwarded Android "scrcpy" session | |
and pipe the video stream into FFPlay | |
https://github.com/Genymobile/scrcpy/ | |
''' | |
import socket | |
import struct | |
import sys |
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
precedencegroup ForwardApplication | |
{ | |
associativity: left | |
higherThan: AssignmentPrecedence | |
} |
AnnexB format:
([start code] NALU) | ( [start code] NALU) |
AVCC format:
([extradata]) | ([length] NALU) | ([length] NALU) |
import Foundation | |
enum Either<A,B> { | |
case left(A) | |
case right(B) | |
} | |
// Works only using Swift 4.1 | |
extension Either: Codable where A: Codable, B: Codable { | |
enum CodingKeys: CodingKey { |
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
// Created by Matthew Johnson on 5/28/16. | |
// Copyright © 2016 Anandabits LLC. All rights reserved. | |
// | |
// This is a minimalist implementation of a responder chain in pure Swift. | |
// | |
// It is not intended to demonstrate the best way to | |
// implement event processing in Swift. | |
// | |
// The intent is to show how little code is necessary to acheive behavior | |
// similar to Cocoa's responder chain in pure Swift. |
from keras.models import Model | |
from keras.layers import ( | |
Input, | |
Dense, | |
Flatten, | |
merge, | |
Lambda | |
) | |
from keras.layers.convolutional import ( | |
Convolution2D, |
The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simulator.
This gist was adapted from the original at https://gist.github.com/BennettSmith/7150245, and updated to deal with Xcode 7 and iOS 9, and download protobuf version 3.0.0.
/** The returned generator will enumerate each value of the provided tuple. */ | |
func generatorForTuple(tuple: Any) -> AnyGenerator<Any> { | |
return anyGenerator(Mirror(reflecting: tuple).children.lazy.map { $0.value }.generate()) | |
} | |
// Blogged at http://design.featherless.software/enumerating-tuple-values-swift/ |