Skip to content

Instantly share code, notes, and snippets.

//
// FilePickerPresentedView.swift
// flysight-grapher
//
// Created by richö butts on 7/8/19.
// Copyright © 2019 richö butts. All rights reserved.
//
import Foundation
import SwiftUI
@pjsier
pjsier / .block
Last active July 11, 2023 18:59
Real-Time Line Chart
license: mit
@vitormeriat
vitormeriat / mqtt-sample.html
Created May 22, 2017 19:22
Demo MQTT, JS, HTML and HighCharts
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example of plotting live data with websockets and highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="mqttws31.js" type="text/javascript"></script>
<script type="text/javascript">
var MQTTbroker = 'test.mosquitto.org';
var MQTTport = 8080;
var MQTTsubTopic = 'meriat/sala1/#'; //works with wildcard # and + topics dynamically now
@thatseeyou
thatseeyou / ViewController.swift
Last active August 10, 2023 13:45
How to capture video frames from the camera as images using AV Foundation on iOS
//
// ViewController.swift
//
// Technical Q&A QA1702
// How to capture video frames from the camera as images using AV Foundation on iOS
//
import UIKit
import AVFoundation
import CoreMedia
@OrganicIrradiation
OrganicIrradiation / equirectangularToStereographic.m
Created March 3, 2016 18:42
Equirectangular to Stereographic Projections (Little Planets) in MATLAB
% Based upon code by nicoptere: http://en.nicoptere.net/?p=315
function outImage = equirectangularToStereographic(FILENAME,OUTSIZE,CAMDIST,WORLDROTATION)
if nargin < 2
OUTSIZE = [1080,1920];
end
if nargin < 3
CAMDIST = 8;
end
if nargin < 4
WORLDROTATION = 0;
import UIKit
extension UIImage {
// colorize image with given tint color
// this is similar to Photoshop's "Color" layer blend mode
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved
// white will stay white and black will stay black as the lightness of the image is preserved
func tint(tintColor: UIColor) -> UIImage {
@travisnewby
travisnewby / CMDeviceMotion.swift
Last active November 12, 2022 17:13
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
@acj
acj / ATTENTION.md
Last active May 5, 2023 12:23
Build a movie from jpeg images in Swift using AVFoundation

This code has moved

Please refer to the TimeLapseBuilder-Swift repository on GitHub from now on.

I will leave the original code here as a reference, but new comments may be removed. Please open an issue on GitHub if you have questions or would like to contribute.

Thanks!

@dynamicguy
dynamicguy / install-opencv-2.4.11-in-ubuntu.sh
Last active April 3, 2024 20:20
install opencv-2.4.11 in ubuntu
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev