Skip to content

Instantly share code, notes, and snippets.

View Nyx0uf's full-sized avatar
🏠
Working from home

Nyx0uf Nyx0uf

🏠
Working from home
View GitHub Profile
@Nyx0uf
Nyx0uf / zeroconf.swift
Last active January 27, 2023 10:49
ZeroConf swift socket
import Foundation
import Logging
protocol ZeroConfExplorerDelegate: AnyObject {
func didFindServer(_ server: MPDServer)
}
final class ZeroConfExplorer: NSObject {
// MARK: - Public properties
// Is searching flag
@Nyx0uf
Nyx0uf / NYXAVCEncoder.swift
Created February 3, 2016 10:35
Hardware accelerated GIF to MP4 converter in Swift using VideoToolbox
import VideoToolbox
import AVFoundation
private var __canHWAVC: Bool = false
private var __tokenHWAVC: dispatch_once_t = 0
public protocol NYXAVCEncoderDelegate : class
{
func didEncodeFrame(frame: CMSampleBuffer)
func didFailToEncodeFrame()
@Nyx0uf
Nyx0uf / gist:217d97f81f4889f4445a
Last active November 15, 2020 22:31
UIImage scale using vImage
-(UIImage*)mmg_imageScaledToFitSize:(CGSize)fitSize
{
// Create a vImage_Buffer from the CGImage
CGImageRef sourceRef = self.CGImage;
vImage_Buffer srcBuffer;
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst,