Skip to content

Instantly share code, notes, and snippets.

View spirit-q2's full-sized avatar

Sergey Matvienko spirit-q2

View GitHub Profile
@spirit-q2
spirit-q2 / gen_image_stable_diff_nvidia.py
Created February 2, 2024 19:48 — forked from qaixerabbas/gen_image_stable_diff_nvidia.py
Generating Images via Nvidia Stable Diffusion XL API
import requests
import base64
# https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ai-foundation/models/sdxl/api
API_KEY = "GET API KEY FROM NVIDIA PLAYGROUND FROM ABOVE LINK IN COMMENT"
invoke_url = "https://api.nvcf.nvidia.com/v2/nvcf/pexec/functions/89848fb8-549f-41bb-88cb-95d6597044a4"
fetch_url_format = "https://api.nvcf.nvidia.com/v2/nvcf/pexec/status/"
headers = {
@spirit-q2
spirit-q2 / raspberry_fast_capture.py
Created January 28, 2024 14:45 — forked from CarlosGS/raspberry_fast_capture.py
Fast reading from the raspberry camera with Python, Numpy, and OpenCV. See the comments for more details.
# Fast reading from the raspberry camera with Python, Numpy, and OpenCV
# Allows to process grayscale video up to 124 FPS (tested in Raspberry Zero Wifi with V2.1 camera)
#
# Made by @CarlosGS in May 2017
# Club de Robotica - Universidad Autonoma de Madrid
# http://crm.ii.uam.es/
# License: Public Domain, attribution appreciated
import cv2
import numpy as np
@spirit-q2
spirit-q2 / ffmpeg.md
Created April 29, 2020 08:20 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

<?php
function processDirectory($start = './', $format = 'array') {
if (!empty($start)) {
$start = rtrim($start, '/') . '/';
}
if (!empty($start) && !is_dir($start)) {
return 'json' === $format ? 'false' : false;
}