Skip to content

Instantly share code, notes, and snippets.

{
"W": 960,
"H": 540,
"show_info_on_ui": true,
"tiling": false,
"restore_faces": false,
"seed_resize_from_w": 0,
"seed_resize_from_h": 0,
"seed": 2456787099,
"sampler": "Euler a",
# get last frame from video
ffmpeg -i input.mp4 -vf select='eq(pict_type\,PICT_TYPE_I)' -vframes 1 output.png
# reverse video
ffmpeg -i input.mp4 -vf reverse output.mp4
import onnx
def print_model_io(model_path):
model = onnx.load(model_path)
# Function to convert Dim objects to list of sizes
def dim_list(tensor_type):
return [d.dim_value for d in tensor_type.shape.dim]
for dir in custom_nodes/*/; do
if [ -d "$dir" ]; then
echo "Entering module: $dir"
(cd $dir && pip install -qq -r requirements.txt)
fi
done
from huggingface_hub import HfApi, hf_hub_url
import os
hf_config = {
"username":"",
"repo_name":"",
"token":""
}
def upload_file_hf(file_path):
@yuvraj108c
yuvraj108c / civitai.py
Created May 28, 2023 10:00
Download civitai model/lora
import requests
from bs4 import BeautifulSoup
web_url = "https://civitai.com/models/7371/rev-animated"
model_type = "model"
# Get download url
response = requests.get(web_url)
soup = BeautifulSoup(response.text, 'html.parser')
url = soup.select(".mantine-UnstyledButton-root.mantine-Button-root.mantine-1movwzg")[0].get("href")
function extractEmailFromString(text: string): string {
const matches = text.match(
/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi
);
return matches ? matches[0] : "";
}
@yuvraj108c
yuvraj108c / ffmpeg.sh
Last active October 6, 2022 08:58
FFMPEG commands
# Remove audio from video file
ffmpeg -i "video.mp4" -c copy -an "output.mp4"
# Merge (video file without audio) with audio file
ffmpeg -i "video.mp4" -i "audio.mp3" -c:v copy -c:a aac "output.mp4"
# Trim video using start/end time (hh:mm:ss)
ffmpeg -ss 00:00:00 -i "video.mp4" -c copy -t 00:00:15 "output.mp4"
# Write text at middle of a video file
@yuvraj108c
yuvraj108c / random_num.js
Created July 12, 2022 10:31
Ger random number in range
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min) ) + min;
}
@yuvraj108c
yuvraj108c / pm2.sh
Created June 3, 2022 11:39
Pm2 run command
pm2 start npm --name <name> -- run <script>