Skip to content

Instantly share code, notes, and snippets.

View mfargo's full-sized avatar

Matthew Fargo mfargo

View GitHub Profile
@mchapman87501
mchapman87501 / install_pyside6_mac_m1.sh
Created October 1, 2021 18:47
Install PySide6 on macOS (Monterey) for M1 (Apple Silicon) Devices - h/t elliewhatever
#!/bin/bash
# Many thanks to
# https://gist.githubusercontent.com/elliewhatever/adbe3fba37d747fb8b04af8f835d46d2/raw/61e2bd530eb434f7ea2f595262e1922cdd057f7c/PySide6.sh
# Assumes brew and python are installed
brew install qt@6 llvm cmake ninja git
# Setup environment relative to current directory -
# this eases building in an existing Python venv.
mkdir -p ./.pyside6; cd ./.pyside6
@mattatz
mattatz / Matrix.hlsl
Last active August 17, 2025 10:41
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
@j-j-m
j-j-m / commonprofile.metal
Created May 8, 2017 00:20
Can't access GL Uniforms in Metal shader modifier? Apple docs for SCNShadable written in terms of GL? Pulling your hair out?... this will help.
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
@vgoltv
vgoltv / FWKSketchFilter.h
Last active July 7, 2024 09:04
CoreImage filter "Sobel Sketch", kernel ported from GPUImageSketchFilter. Objective-C
//
// FWKSketchFilter.h
// LineEngraver
//
// Created by Viktor Goltvyanytsya on 8/4/16.
// http://www.fwkit.com
//
// Ported from https://github.com/BradLarson/GPUImage/blob/master/framework/Source/GPUImageSketchFilter.m
@jimstudt
jimstudt / UIColor-colorWithKelvin.swift
Created November 15, 2015 20:47
An iOS extension to UIColor to get a white point corresponding to a temperature.
extension UIColor {
// based on http://www.zombieprototypes.com/?p=210 who looked at some data and did a bunch of curve fitting
static func colorWithKelvin( kelvin: CGFloat) -> UIColor {
let k = kelvin < 1000 ? 1000 : ( kelvin > 40000 ? 40000 : kelvin)
func interpolate( value: CGFloat, a: CGFloat, b:CGFloat, c:CGFloat) -> CGFloat {
return a + b*value + c*log(value)
}