Skip to content

Instantly share code, notes, and snippets.

@AlLongley
AlLongley / scrcpy_ffplay.py
Last active October 5, 2023 14:34
Android screen viewing Python client to "scrcpy"
'''
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
}
@XueshiQiao
XueshiQiao / h264format.md
Last active February 26, 2023 15:44
H.264 Annex B format and AVCC format

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 {
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
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.


Effective Engineer - Notes

What's an Effective Engineer?

@anandabits
anandabits / swift-responder-chain.swift
Last active March 1, 2022 23:45
A minimalist responder chain implemented in pure Swift
// 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.
@neggert
neggert / inception_v3.py
Created April 6, 2016 17:35
Inception-v3 implementation in Keras
from keras.models import Model
from keras.layers import (
Input,
Dense,
Flatten,
merge,
Lambda
)
from keras.layers.convolutional import (
Convolution2D,
@petewarden
petewarden / ..build-protobuf-3.0.0.md
Last active September 27, 2022 08:19 — forked from BennettSmith/..build-protbuf-2.5.0.md
Script used to build Google Protobuf 3.0.0 for use with Xcode 7 / iOS 9. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 3.0.1 - Mac OS X and iOS Support

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.

@jverkoey
jverkoey / Tuple+Generator.swift
Last active February 3, 2018 22:59
Tuple enumeration
/** 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/