Skip to content

Instantly share code, notes, and snippets.

@mob-sakai
mob-sakai / _README.md
Last active Apr 4, 2022
Run shell script on gist
View _README.md

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:
@davidwebca
davidwebca / gist:e26186b8f4c6795b19c043fffb6f9861
Last active Feb 13, 2022
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 https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e
# Who got inspired by https://stackoverflow.com/a/38205105
#!/bin/bash
file=""
out="./"
dur=0.05
stripaudio=""
@miguelgrinberg
miguelgrinberg / .vimrc
Last active May 20, 2022
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
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
View ESP32-CAM sdcard read and write
// This post referred to this git. I just trimmed cam and wifi part.
// https://github.com/v12345vtm/CameraWebserver2SD/blob/master/CameraWebserver2SD/CameraWebserver2SD.ino
#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);
@tilfin
tilfin / face_cropper.py
Created Dec 27, 2016
Face detect and crop by using OpenCV
View face_cropper.py
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)
@ulyssesr
ulyssesr / nginx.conf
Last active Feb 5, 2022
Nginx RTMP Setup
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@charlee
charlee / ffmpeg.sh
Last active Jan 19, 2022
ffmpeg tips
View ffmpeg.sh
# 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'
@dideler
dideler / pyargs.md
Last active May 9, 2022
Parsing Command-Line Argument in Python
View pyargs.md

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).