Create a command line target in xcode either in Swift or Obj-C. add a metal file to the project and copy and paste the respective code into each file.
import csv, os | |
def add_csv_column(filename: str, column_name: str, data: list) -> None: | |
""" | |
Add a column of data to an existing csv file | |
pads with empty string if data size does not match target csv | |
:param filename: path to csv file |
Create a Swift Command Line Tool in Xcode. You can then copy and paste the below code into the .swift
and .metal
files respectively
main.swift
#include <iostream> | |
#include <memory> | |
void setPtr (int *a) | |
{ | |
std::cout << *a << '\n'; | |
} | |
int main(int argc, const char * argv[]) | |
{ |
# verbose, but customisable
ffmpeg -i VIDEO.EXTENSION -vf "fps=10,scale=680:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 OUT.gif
# gritty, but portable
This brief script came about from numerous requests to play multiple videos in sync with each other from a single machine. The videos were to have different content but would be of the same duration. Achieving this on macOS has proved to be a little tricky to say the least. It is possible to run multiple instance of VLC so that videos can be played concurrently from the same machine.
Be aware that this method does not enforce any syncing, so it is possible for the videos to fall out of sync, especially if the are not exactly the same frame count and encoding.
If precision is required you may want to invest in a ocuple of Rapsberry Pis and check out the following
import Foundation | |
import Cocoa | |
for screen in NSScreen.screens | |
{ | |
print(screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")]!); | |
} |
//============================================================================== | |
// Print all installed audio unit effects in Swift | |
// Handy in for debugging in a Swift console app | |
//============================================================================== | |
import Foundation | |
import AVFoundation | |
//============================================================================== | |
var availableAudioUnits = [AVAudioUnitComponent]() | |
//============================================================================== | |
func updateAudioUnitList() |