Skip to content

Instantly share code, notes, and snippets.

View loganblevins's full-sized avatar

Logan Blevins loganblevins

View GitHub Profile
@loganblevins
loganblevins / Apple_mobile_device_types.txt
Created December 18, 2020 19:20 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
@loganblevins
loganblevins / CMSampleBufferRef_to_vImage.m
Created March 31, 2020 20:18 — forked from podkovyrin/CMSampleBufferRef_to_vImage.m
CMSampleBufferRef to vImage and resize
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer,0);
size_t height = CVPixelBufferGetHeight(imageBuffer);
size_t width = CVPixelBufferGetWidth(imageBuffer);
size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer);
void *sourceData = CVPixelBufferGetBaseAddress(imageBuffer);
// Set a bunch of variables we need. The "radius" for the blur kernel needs to be positive and odd. The permute map maps the BGRA channels of the buffer to the ARGB that vImage needs.
@loganblevins
loganblevins / UIImageToDataTests.swift
Created February 19, 2020 17:57 — forked from benbahrenburg/UIImageToDataTests.swift
Swift Playground for testing memory associated with converting UIImage to Data
import UIKit
import ImageIO
import MobileCoreServices
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func report_memory() -> UInt64 {
var taskInfo = mach_task_basic_info()
var count = mach_msg_type_number_t(MemoryLayout<mach_task_basic_info>.size)/4
@loganblevins
loganblevins / ..build-apple-protobuf-3.6.1.md
Last active August 29, 2018 21:03 — forked from petewarden/..build-protobuf-3.0.0.md
Script used to build Google Protobuf 3.6.1 for use with Xcode 9 / iOS 11. Builds for all supported architectures and produces a universal binary static library.

Google Protobuf 3.6.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, further adapted from https://gist.github.com/petewarden/c8d172709018780eb069 and updated to deal with iPhone Simulator - i386 issues when building on >=Sierra, and download protobuf version 3.6.1.