Skip to content

Instantly share code, notes, and snippets.

charlee /
Last active January 19, 2022 15:05
ffmpeg tips
# losslessly concat mp4 files
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
# concat files with the same format
# 1. create a file list
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
View ESP32-CAM sdcard read and write
// This post referred to this git. I just trimmed cam and wifi part.
#include "FS.h"
#include "SD_MMC.h"
//List dir in SD card
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
Serial.printf("Listing directory: %s\n", dirname);
dideler /
Last active January 23, 2023 16:39
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

tilfin /
Created December 27, 2016 13:18
Face detect and crop by using OpenCV
import cv2
import sys
import os
class FaceCropper(object):
CASCADE_PATH = "data/haarcascades/haarcascade_frontalface_default.xml"
def __init__(self):
self.face_cascade = cv2.CascadeClassifier(self.CASCADE_PATH)
davidwebca / gist:e26186b8f4c6795b19c043fffb6f9861
Last active December 18, 2023 15:29
Detect black screen and split with ffmpeg remux
View gist:e26186b8f4c6795b19c043fffb6f9861
# Splits video to separate scenes files when full black frames are found in the video
# Inspired by
# Who got inspired by
miguelgrinberg / .vimrc
Last active January 25, 2024 20:32
My .vimrc configuration for working in Python with vim
View .vimrc
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
let need_to_install_plugins = 1
call plug#begin()
Plug 'tpope/vim-sensible'
ulyssesr / nginx.conf
Last active February 19, 2024 03:13
Nginx RTMP Setup
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
mob-sakai /
Last active February 20, 2024 00:29
Run shell script on gist

Run shell script on gist

Shells that support process substitution such as bash and zsh allow to run shell script on gist as follows.

# With curl:
bash <(curl -sL ${GIST_URL}) args...

# With wget:
EverythingSmartHome / esp32-voice.yaml
Last active February 23, 2024 00:18
ESP32 & ESPHome Voice Assistant
View esp32-voice.yaml
name: esp32-mic-speaker
friendly_name: esp32-mic-speaker
- priority: -100
- wait_until: api.connected
- delay: 1s
- if: