Skip to content

Instantly share code, notes, and snippets.

View vvzen's full-sized avatar
🎥
Pipeline Dev @ Apple, London 🇬🇧

Valerio Viperino vvzen

🎥
Pipeline Dev @ Apple, London 🇬🇧
View GitHub Profile
@vvzen
vvzen / scene_detection.sh
Last active February 3, 2022 01:21
WIP: Automatic scene detection of Editorial Reference movies
#!/bin/bash
input_video=$1
# Parameters
scene_detection_score="0.3"
tesseract="/Users/vvzen/Desktop/framestore/experimental-development/automatic-TO-recognition/ocr/tesseract/tesseract"
# My testing has been done with
# tesseract 5.0.1-9-g31a968
# leptonica-1.81.1
@vvzen
vvzen / check_contributions.sh
Created December 10, 2021 20:19
spaghetti one liner to check git contributions of a repo (bash)
IFS=$'\n'; for author in `git shortlog --summary --numbered | awk '{print $2 " " $3}'`; do echo -e $author; git log --author="$author" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "\tadded lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'; done
@vvzen
vvzen / create_ffmpeg_commands.py
Last active March 21, 2021 15:10
create a series of FFMPEG commands to 1) trim video/audio from a source 2) add audio/video fade in, fade out
#!/bin/env python3
import os
current_dir = os.path.dirname(os.path.realpath(__file__))
source = 'my_ProRes.mov'
ffmpeg_command_template = ( 'ffmpeg \\\n'
'-loop 1 -r {fps} -t 5 -i black.jpg \\\n'
'-ss {start} -r {fps} \\\n'
@vvzen
vvzen / convert_python_files_from_camelCase_to_snake_case.py
Last active February 1, 2021 11:40
Convert a python camelCase code base to snake_case
"""
This is currently highly experimental!!
Please make a backup before testing it..
"""
from __future__ import print_function
import os
import re
import sys
@vvzen
vvzen / save_geotiff_as_ply.ipynb
Last active January 1, 2021 12:45
Geospatial workflows in Houdini - Save GeoTIFF to PLY
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vvzen
vvzen / cli_utils.sh
Last active October 11, 2020 11:41
CLI oneliners accumulated during my life, tested on macOS
# This stuff was tested on zsh. It should work on bash but won't work on tcsh for sure!
# Dumb way to sort du output by size and only list up to the 50 top dirs that we can access
# |& is used to pipe stderr to the next command
#
du -k |& grep -v "Permission denied" | sort -nr | cut -f2 | head -n 50 | xargs du -sh |& grep -v "Permission denied" |& grep -v "No such" |& grep -v "Operation not"
# Compute the percentage of something
# 710 here is final expected number of files, we use `ls | wc -l` to get the current num of files
# then we pipe it into bc to do the math, then print to the console and save to file at the same time using tee
@vvzen
vvzen / find_centroid_of_clusters.cpp
Last active September 12, 2020 21:14
VEX code for finding centroids of clusters made with Houdini cluster node
// The cluster node in houdini creates 2 groups:
// attributepoints and clusterpoints
// but I need an attribute to store, for each cluster, the centroid
// So what I've come up is to...
// 1. Create an attribute on each point, called centroid
// and formatted like this: "{index_of_the_point}_{index_of_the_cluster}"
// See set_centroid_attribute.cpp
// 2. Use it so that each point will loop in all other points
@vvzen
vvzen / AssetModel.qml
Last active September 14, 2019 13:58
Learning QML - Layouts (sketch for fbf-publish)
import QtQuick 2.0
ListModel {
id: assetModel
ListElement {
name: 'env_building_020'
cbPublishAsset: true
assetsComponents:[
@vvzen
vvzen / build_opencv_mojave.sh
Last active August 3, 2019 21:00
Build OpenCV4 on macOS mojave using conda python
#!/bin/sh
# Replace all python3.5 with your version
export CONDA_ENV_DIR=~/miniconda3/envs/cv
export CPLUS_INCLUDE_PATH=$CONDA_ENV_DIR/lib/python3.5
export OPENCV_CONTRIB_DIR=~/Documents/code/learning/python/opencv/opencv_contrib
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=$OPENCV_CONTRIB_DIR/modules \
-D PYTHON3_LIBRARY=$CONDA_ENV_DIR/lib/python3.5m.dylib \
@vvzen
vvzen / fallbackstyle.json
Created August 3, 2019 12:27
vscode c++ clang-format
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}"