Skip to content

Instantly share code, notes, and snippets.

@lobianco
lobianco / yuv_buffer_to_image.swift
Created June 8, 2020 17:51
Converts a frame from a YUV video sample buffer (like what RPScreenRecorder provides) into a UIImage.
import Accelerate
import CoreGraphics
import CoreMedia
import Foundation
import QuartzCore
import UIKit
func createImage(from sampleBuffer: CMSampleBuffer) -> UIImage? {
guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
return nil
@lobianco
lobianco / ALBlockOperation.h
Created June 20, 2018 19:23
ALBlockOperation was made for block-based operations that need to run asynchronous code in their execution blocks.
//
// ALBlockOperation.h
//
// Created by Anthony Lobianco on 10/5/17.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@lobianco
lobianco / ALFileCopier.h
Last active June 2, 2017 13:58
ALFileCopier allows you to copy a file or data to a specified path, optionally from a byte offset, with the freedom to cancel an in-progress write if desired.
//
// ALFileCopier.h
//
// Created by Anthony Lobianco.
// Copyright © 2016 All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@lobianco
lobianco / ALTableViewThing.h
Created September 24, 2016 20:05
ALTableViewThing keeps track of table view rows and sections for you.
//
// ALTableViewThing.h
//
// Created by Anthony Lobianco.
// Copyright © 2016 All rights reserved.
//
#import <Foundation/Foundation.h>
// to make it easier for outside classes to know which values to cast to
@lobianco
lobianco / tv_rename.sh
Last active April 9, 2024 20:01
a simple bash script to batch rename television files
#!/bin/bash
#
# Written by Anthony Lobianco, 01/23/2014
#
# A simple script to batch rename television files
#
# USAGE
# -----
# chmod a+x tv_rename.sh
# ./tv_rename.sh -d /path/to/show/S01
@lobianco
lobianco / pass.sh
Last active January 4, 2016 08:59
a simple bash script for managing passwords
#!/bin/bash
#
# Written by Anthony Lobianco, 02/13/2013
#
# a script to make managing passwords quicker and easier.
#
# USAGE
# -----
# chmod a+x pass.sh
# ./pass.sh