Skip to content

Instantly share code, notes, and snippets.

@thepian
thepian / prd-creation-assistant.md
Created May 15, 2025 12:16
PRD Creation Assistant

PRD Creation Assistant

Role and Identity

You are a professional product manager and software developer who is friendly, supportive, and educational. Your purpose is to help beginner-level developers understand and plan their software ideas through structured questioning, ultimately creating a comprehensive PRD.md file.

Conversation Approach

  • Begin with a brief introduction explaining that you'll ask clarifying questions to understand their idea, then generate a PRD.md file.
  • Ask questions one at a time in a conversational manner.
  • Focus 70% on understanding the concept and 30% on educating about available options.
  • Keep a friendly, supportive tone throughout.
@xocialize
xocialize / jerry.swift
Created April 18, 2025 18:08 — forked from vorce/jerry.swift
Mouse move and click test thing for macos in swift
import Cocoa
import Foundation
// Move around and click automatically at random places in macos, kinda human like in a cheap way.
// Moves the mouse pointer to `moves` random locations on the screen and runs the `action` function at
// each point with the point as argument.
func mouseMoveWithAction(moves: Int, action: (CGPoint) -> Void = defaultAction) {
let screenSize = NSScreen.main?.visibleFrame.size
@ctreffs
ctreffs / MTLARFrameProcessor.swift
Created November 16, 2023 14:08
Processes ARKits' ARFrame->capturedImage CVPixelBuffer according to the documentation into an sRGB image
import CoreImage
import CoreVideo
import ImageIO
import Metal
/// Processes ARKits' ARFrame->capturedImage CVPixelBuffer according to the documentation into an sRGB image.
///
/// ARKit captures pixel buffers in a full-range planar YCbCr format (also known as YUV) format according to the ITU R. 601-4 standard.
/// (You can verify this by checking the kCVImageBufferYCbCrMatrixKey pixel buffer attachment.)
/// Unlike some uses of that standard, ARKit captures full-range color space values, not video-range values.
import Foundation
import CoreMediaIO
let CMIOExtensionPropertyCustomPropertyData_just: CMIOExtensionProperty = CMIOExtensionProperty(rawValue: "4cc_just_glob_0000")
let CMIOExtensionPropertyCustomPropertyData_dust: CMIOExtensionProperty = CMIOExtensionProperty(rawValue: "4cc_dust_glob_0000")
...
class cameraStreamSource: NSObject, CMIOExtensionStreamSource {
@hradec
hradec / nsimage_photogrammetrySample.swift
Last active April 15, 2025 16:38
NSImage extension with functions that convert it to Depth, Disparity, Color and Mask CVPixelBuffer to be used directly in a PhotogrammetrySample object.
// this code is based on the original extension found in this
// other gist: https://gist.github.com/DennisWeidmann/7c4b4bb72062bd1a40c714aa5d95a0d7
// thanks Dennis Weidmann!
extension NSImage {
// function used by all functions below. It shouldn't be used directly
func __toPixelBuffer(PixelFormatType: OSType) -> CVPixelBuffer? {
var bitsPerC = 8
var colorSpace = CGColorSpaceCreateDeviceRGB()
var bitmapInfo = CGImageAlphaInfo.noneSkipFirst.rawValue
@uttarwarsandesh33
uttarwarsandesh33 / deepCopyRecursion.js
Last active September 12, 2021 14:47
Create deep copy with recursive method
//recursive method to create deep copy
function deepCopy(obj) {
if (null === obj || 'object' !== typeof obj) return obj;
switch (obj.constructor) {
case Boolean:
return new Boolean(obj);
case Number:
return new Number(obj);
@prof3ssorSt3v3
prof3ssorSt3v3 / app.js
Created March 12, 2021 14:29
Code for Service Workers 8 - Messaging between Clients and Workers
const APP = {
SW: null,
init() {
//called after DOMContentLoaded
//register our service worker
APP.registerSW();
document
.getElementById('colorForm')
.addEventListener('submit', APP.saveColor);
// Don't forget to add to the project:
// 1. DeepLabV3 - https://developer.apple.com/machine-learning/models/
// 2. CoreMLHelpers - https://github.com/hollance/CoreMLHelpers
enum RemoveBackroundResult {
case background
case finalImage
}
extension UIImage {
@rampadc
rampadc / createSampleBufferFromPixelBuffer.swift
Created February 21, 2021 09:24
Create a CMSampleBuffer from CVPixelBuffer
// Usage
let pixelBuffer: CVImageBuffer? = createPixelBufferFrom(image: image) // see https://gist.github.com/rampadc/10a7dc257552f1fb86c1fcc2d1671bd9
let sampleBuffer: CMSampleBuffer? = createSampleBufferFrom(pixelBuffer: pixelBuffer)
// Function
func createSampleBufferFrom(pixelBuffer: CVPixelBuffer) -> CMSampleBuffer? {
var sampleBuffer: CMSampleBuffer?
var timimgInfo = CMSampleTimingInfo()
var formatDescription: CMFormatDescription? = nil
@talkingmoose
talkingmoose / MegaPKGr.zsh
Last active August 16, 2025 01:51
The pkgbuild binary and Jamf Composer don't support adding single files of 8 GB or more to a package. Some apps like Install macOS Big Sur.app include files larger than 8 GB in their bundles. This script will create a deployable PKG file from apps whose bundles include those large files.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/e9ed319226c6da30dd633725e48a97b0