Skip to content

Instantly share code, notes, and snippets.

View Toni77777's full-sized avatar

Anton Paliakov Toni77777

View GitHub Profile
@dineshprasanna
dineshprasanna / composition.m
Created October 5, 2012 06:03 — forked from stuffmc/composition.m
AVComposition & AVVideoComposition
// For whatever reason (I guess because my code is wrong) the "composition" returns twice the same asset (one transformed, one not),
// although it should display 2 different videos... If anybody has a clue :(
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], AVURLAssetPreferPreciseDurationAndTimingKey, nil];
AVMutableComposition *composition = [AVMutableComposition composition];
CMTimeRange timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(4, 1));
AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoComposition];
// Track B
@bigday
bigday / MixVideoWithText
Created August 31, 2015 07:27
MixVideoWithText
#import <AVFoundation/AVFoundation.h>
-(void)MixVideoWithText
{
AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:url options:nil];
AVMutableComposition* mixComposition = [AVMutableComposition composition];
AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
AVAssetTrack *clipVideoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
@steve228uk
steve228uk / buttons.swift
Last active October 10, 2021 07:23
Move NSWindow standardWindowButtons in Swift
// Add this to your main view.
override func viewDidLayout() {
super.viewDidLayout()
if let btn = view.window?.standardWindowButton(.closeButton) {
btn.removeFromSuperview()
btn.setFrameOrigin(NSPoint(x: 12, y: 28))
view.addSubview(btn)
@andreacipriani
andreacipriani / Bash.swift
Last active February 15, 2024 12:50
Execute shell/bash commands from Swift
import UIKit
protocol CommandExecuting {
func run(commandName: String, arguments: [String]) throws -> String
}
enum BashError: Error {
case commandNotFound(name: String)
}
@pdyakov
pdyakov / etherium-quick-start.js
Last active March 29, 2018 08:00
Etherium Blockchain Platform Quick Start
// How to connect to Etherium Blockchain Platform
// Emitting events and listening for events within blockchain network
var Web3 = require('web3');
const HOST = '';
const ACCOUNT = '';
const ContractData = {...};
// Connection
@christianascone
christianascone / UIView+Extension.swift
Last active October 7, 2021 08:54
UIView extension for setting an hexagonal mask on layer
import Foundation
// http://sapandiwakar.in/make-hexagonal-view-on-ios/
extension UIView {
/// Set the view layer as an hexagon
func setupHexagonView() {
let lineWidth: CGFloat = 5
let path = self.roundedPolygonPath(rect: self.bounds, lineWidth: lineWidth, sides: 6, cornerRadius: 10, rotationOffset: CGFloat(.pi / 2.0))
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active July 17, 2024 19:34
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@atereshkov
atereshkov / macos-ssh-keychain.txt
Created September 16, 2017 10:52
How to add a SSH Key to your MacOS Keychain
On Mac OSX, the native SSH client can use the built-in keychain directly.
Open terminal.
Write:
mkdir ~/.ssh
cd ~/.ssh
Copy your private key "id_rsa" to /.ssh folder.
Write in terminal also:
@Tulakshana
Tulakshana / MovieTransitionsVC.swift
Last active January 12, 2023 08:25 — forked from SheffieldKevin/movietransitions.swift
Make a movie with transitions with AVFoundation and swift. Add an UIActivityIndicatorView and an UIButton and connect appropriately. You will also need to attach few videos to the project.
//
// MovieTransitionsVC.swift
// VideoAnimations
//
// Created by Tula on 2018-06-14.
// Copyright © 2018 Tula. All rights reserved.
//
import UIKit
import AVFoundation