Skip to content

Instantly share code, notes, and snippets.

View RahulBhalley's full-sized avatar
🏠
Working from home

RahulBhalley

🏠
Working from home
View GitHub Profile
@realvjy
realvjy / ChoasLinesShader.metal
Last active October 23, 2024 20:57
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);

[This portion of call begins at 25:47]

Me: I could make it really easy on you, if you think Apollo is costing you $20 million per year, cut me a check for $10 million and we can both skip off into the sunset. Six months of use. We're good. That's mostly a joke.

Reddit: Six months of use? What do you mean? I know you said that was mostly a joke, but I want to take everything you're saying seriously just to make sure I'm not - what are you referring to?

Me: Okay, if Apollo's opportunity cost currently is $20 million dollars. At the 7 billion requests and API volume. If that's your yearly opportunity cost for Apollo, cut that in half, say for 6 months. Bob's your uncle.

Reddit: You cut out right at the end. I'm not asking you to repeat yourself for a third time, but you legit cut out right at the end. "If your opportunity cost is $10 million" and then I lost you.

import math
import safetensors
import torch
from diffusers import DiffusionPipeline
"""
Kohya's LoRA format Loader for Diffusers
Usage:
```py
@karpathy
karpathy / stablediffusionwalk.py
Last active October 1, 2024 09:56
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@hradec
hradec / nsimage_photogrammetrySample.swift
Last active December 22, 2023 09:26
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
@t-vi
t-vi / speech_command_recognition_quantization_full.ipynb
Created July 19, 2021 10:51
Code for Training an Edge Optimized Speech Recognition Model with PyTorch Lightning
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@satanworker
satanworker / carousel.swift
Last active September 24, 2022 14:31
SwiftUI full width carousel
# IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX
#
# WIP research. (This was edited to add more info after someone posted it to
# Hacker News. Click "Revisions" to see full changes.)
#
# Copyright (c) 2020 dougallj
# Based on Python port of VMX intrinsics plugin:
# Copyright (c) 2019 w4kfu - Synacktiv
@rorodriguez116
rorodriguez116 / SetZoom.swift
Created October 24, 2020 18:41
Configuring the zoom factor in the video capture device.
public func set(zoom: CGFloat){
let factor = zoom < 1 ? 1 : zoom
let device = self.videoDeviceInput.device
do {
try device.lockForConfiguration()
device.videoZoomFactor = factor
device.unlockForConfiguration()
}
catch {
@rorodriguez116
rorodriguez116 / PhotoCapture.swift
Created October 23, 2020 21:10
Photo capture function
// MARK: Capture Photo
/// - Tag: CapturePhoto
public func capturePhoto() {
if self.setupResult != .configurationFailed {
self.isCameraButtonDisabled = true
sessionQueue.async {
if let photoOutputConnection = self.photoOutput.connection(with: .video) {
photoOutputConnection.videoOrientation = .portrait