Skip to content

Instantly share code, notes, and snippets.

View Limon-O-O's full-sized avatar
🍋

Limon Limon-O-O

🍋
View GitHub Profile
@Limon-O-O
Limon-O-O / BrightnessValue.swift
Created November 9, 2016 05:58
get brightness value from CMSampleBuffer
func getBrightnessValue(from sampleBuffer: CMSampleBuffer) -> Float {
guard
let metadataDict = CMCopyDictionaryOfAttachments(nil, sampleBuffer, kCMAttachmentMode_ShouldPropagate) as? [String: Any],
let exifMetadata = metadataDict[String(kCGImagePropertyExifDictionary)] as? [String: Any],
let brightnessValue = exifMetadata[String(kCGImagePropertyExifBrightnessValue)] as? Float
else { return 0.0 }
return brightnessValue
}
@Limon-O-O
Limon-O-O / TransitionCompositionBuilder.swift
Last active July 16, 2023 15:04
Merging videos with cross-fade effect using AVFoundation
//
// TransitionComposition.swift
// MED
//
// Created by Limon on 7/26/16.
// Copyright © 2016 MED. All rights reserved.
//
import AVFoundation
@Limon-O-O
Limon-O-O / AVCaptureDevice+FrameRate.swift
Created October 31, 2016 07:48
Control video frame rate with AVFoundation
extension AVCaptureDevice {
/// http://stackoverflow.com/questions/21612191/set-a-custom-avframeraterange-for-an-avcapturesession#27566730
func configureDesiredFrameRate(_ desiredFrameRate: Int) {
var isFPSSupported = false
do {
if let videoSupportedFrameRateRanges = activeFormat.videoSupportedFrameRateRanges as? [AVFrameRateRange] {
@Limon-O-O
Limon-O-O / update_build_number.sh
Created September 28, 2020 09:29 — forked from airdrummingfool/update_build_number.sh
Update current Xcode target's build number with the number of commits on a specified branch. http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/
#!/bin/bash
# update_build_number.sh
# Usage: `update_build_number.sh [branch]`
# Run this script after the 'Copy Bundle Resources' build phase
# Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/
branch=${1:-'master'}
buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count))
echo "Updating build number to $buildNumber using branch '$branch'."
@Limon-O-O
Limon-O-O / CyanifyOperation.swift
Created September 4, 2016 09:33
Defines a subclass of NSOperation that adjusts the color of a video file.
//
// CyanifyOperation.swift
// MED
//
// Created by Limon on 2016/7/19.
// Copyright © 2016年 MED. All rights reserved.
//
import AVFoundation
import Dispatch
@Limon-O-O
Limon-O-O / CocoapodsModule.ruby
Created November 16, 2017 10:09
Cocoapods Support Module
def generate_modulemap(name, path)
f = File.new(File.join("#{path}/module.modulemap"), "w+")
module_name = "#{name}"
while(module_name["+"])
module_name["+"] = "_"
end
f.puts("module XB#{module_name} {")
f.puts(" umbrella header \"#{name}_umbrella.h\"")
f.puts(" export *")
f.puts("}")
@Limon-O-O
Limon-O-O / README.md
Created August 17, 2017 19:54 — forked from JamesMenetrey/README.md
Install Oh-My-Zsh + iTerm2 with Solarized + System-wide console in 2017 (macOS)

Install iTerm2 with Solarized in 2017

Here is the looks and feel of your terminal once the tutorial has been applied on your system:

Install iTerm2

Using Homebrew:

@Limon-O-O
Limon-O-O / movietransitions.swift
Created July 24, 2016 15:07 — forked from SheffieldKevin/movietransitions.swift
Make a movie with transitions with AVFoundation and swift
//
// main.swift
// mutablecomposition
//
// Created by Kevin Meaney on 24/08/2015.
// Copyright (c) 2015 Kevin Meaney. All rights reserved.
//
import Foundation
@Limon-O-O
Limon-O-O / release.sh
Created February 28, 2017 05:48
Release Pod script.
#!/bin/bash
BGreen='\033[1;32m'
Default='\033[0;m'
podName=""
version=""
podspecFilePath=""
homepage=""
httpsRepo=""
@Limon-O-O
Limon-O-O / update_version.sh
Last active February 27, 2017 16:21
Script for Incrementing Version Numbers
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
# ./update-version.sh --version=1.2.9 --build=95 --target=MonkeyKing
# We use PlistBuddy to handle the Info.plist values. Here we define where it lives.
plistBuddy="/usr/libexec/PlistBuddy"
BGreen='\033[1;32m'
# Parse input variables and update settings.