Skip to content

Instantly share code, notes, and snippets.

View sethmills21's full-sized avatar

Seth Miller sethmills21

View GitHub Profile
@rayfix
rayfix / fiindsize.swift
Created February 7, 2016 05:30
Getting the Size of a file or directory in Swift
//
// main.swift
// findsize
//
// Created by Ray Fix on 2/6/16.
// Copyright © 2016 Neko Labs. All rights reserved.
//
import Foundation
@wuyongrui
wuyongrui / renderSepiaEffectIntoAsset.swift
Created March 22, 2016 10:02
renderSepiaEffectIntoAsset
// https://osxentwicklerforum.de/index.php/Thread/24626-AVFoundation-CALayer/
-(void)renderSepiaEffectIntoAsset:(AVAsset*)asset withOnCompletion:(void(^)(NSURL* fileURL))aBlock{
CALayer* sepiaLayer = [CALayer layer];
sepiaLayer.frame = CGRectMake(20, 20, 320,480);
CIFilter *myFilter = [CIFilter filterWithName:@"CISepiaTone"];
[myFilter setDefaults];
[myFilter setValue:[NSNumber numberWithFloat:0.8f] forKey:@"inputIntensity"];
@at-daonguyen
at-daonguyen / Podfile
Created June 30, 2016 03:45
Disable BITCODE for all Pods
source 'https://github.com/CocoaPods/Specs.git'
inhibit_all_warnings!
platform :ios, '8.0'
use_frameworks!
target 'Example' do
# frameworks
end
# BITCODE bug fix
@akesson
akesson / iOSUIImageArray2Video.swift
Last active August 31, 2022 12:45
[iOS] UIImage array 2 Video
//http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie/3742212#3742212
import AVFoundation
import UIKit
import Photos
struct RenderSettings {
var width: CGFloat = 1334
var height: CGFloat = 750
@omarojo
omarojo / imageToPixelBuffer.m
Last active July 11, 2022 08:57
Image to CVPixelBuffer OBJC
let myPixelBuffy = [self pixelBufferFromCGImage:[[UIImage imageNamed:@"myImage.png"] CGImage]];
- (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image
{
CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
nil];
@gbitaudeau
gbitaudeau / Int+Extenstion.swift
Created March 3, 2017 09:44
iOS solution to convert large numbers to smaller format. See : http://stackoverflow.com/a/35504720/1661338
extension Int {
func formatUsingAbbrevation () -> String {
let numFormatter = NSNumberFormatter()
typealias Abbrevation = (threshold:Double, divisor:Double, suffix:String)
let abbreviations:[Abbrevation] = [(0, 1, ""),
(1000.0, 1000.0, "K"),
(100_000.0, 1_000_000.0, "M"),
(100_000_000.0, 1_000_000_000.0, "B")]
- (void)fixVideoUrl:(NSURL *)url completion:(void (^)(NSURL *outputUrl))completion {
// output file
NSString* docFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* outputPath = [docFolder stringByAppendingPathComponent:@"output2.mov"];
if ([[NSFileManager defaultManager] fileExistsAtPath:outputPath]) {
[[NSFileManager defaultManager] removeItemAtPath:outputPath error:nil];
}
// input file
AVAsset* asset = [AVAsset assetWithURL:url];
@teocci
teocci / compile_ffmpeg.md
Last active December 18, 2022 00:15
Compile FFmpeg on Ubuntu 16.04

Compile FFmpeg on Ubuntu

This basic guide supports Ubuntu Xenial Xerus 16.04 and will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide][1].

Note: Copy and paste the whole code box for each step.

Preparation

@mjurincic
mjurincic / nginx.conf
Last active June 30, 2022 16:05 — forked from tomysmile/node-setup-pm2-nginx.md
Setup NodeJS Production with PM2, Nginx on AWS Ubuntu 16.04 server
proxy_http_version 1.1;
proxy_set_header Connection "";
https://gist.github.com/miguelmota/6912559
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
extension UIViewController {
var compatibleSafeInsets: UIEdgeInsets {
if #available(iOS 11, *) {
return view.safeAreaInsets
} else {
return UIEdgeInsetsMake(topLayoutGuide.length, 0, bottomLayoutGuide.length, 0)
}
}
}