Skip to content

Instantly share code, notes, and snippets.

@mkormendy
mkormendy / setup-unifi-macos.sh
Created March 1, 2021 07:20
UniFi Network Controller Setup for MacOS with Homebrew
#!/bin/sh
brew tap homebrew/cask-drivers
brew install --cask homebrew/cask-versions/adoptopenjdk8
brew install --cask ubiquiti-unifi-controller
@guillermo
guillermo / svg2pdf.bash
Created December 1, 2020 16:57 — forked from s417-lama/svg2pdf.bash
Reliable way to convert an SVG file to a PDF file using headless Chrome
#!/bin/bash
#
# Convert an SVG file to a PDF file by using headless Chrome.
#
if [ $# -ne 2 ]; then
echo "Usage: ./svg2pdf.bash input.svg output.pdf" 1>&2
exit 1
fi
@Nepherte
Nepherte / synology-import-ssl.sh
Last active October 17, 2023 14:43
Script to import an SSL certificate into a Synology NAS.
#!/usr/bin/env bash
# The id of the certificate to install.
CERT_ID="$1"
# The packages whose certificate to replace.
CERT_PKGS="${@:2}"
# The directory that holds to certificate to import.
CERT_IMPORT_DIR="/tmp/certificate/$CERT_ID"
@s417-lama
s417-lama / svg2pdf.bash
Created April 29, 2020 07:18
Reliable way to convert an SVG file to a PDF file using headless Chrome
#!/bin/bash
#
# Convert an SVG file to a PDF file by using headless Chrome.
#
if [ $# -ne 2 ]; then
echo "Usage: ./svg2pdf.bash input.svg output.pdf" 1>&2
exit 1
fi
@wbhinton
wbhinton / stabilize-ffmpeg.md
Last active March 16, 2023 14:02
Video Stabilization

Default

ffmpeg -i shaky-input.mp4 -vf vidstabdetect=shakiness=5:accuracy=15:stepsize=6:mincontrast=0.3:show=2 -y dummy.mp4
ffmpeg -i shaky-input.mp4 -vf scale=trunc((iw*1.15)/2)*2:trunc(ow/a/2)*2 -y scaled.mp4
ffmpeg -i scaled.mp4 -vf vidstabtransform=smoothing=30:input="transforms.trf":interpol=linear:crop=black:zoom=-15:optzoom=0,unsharp=5:5:0.8:3:3:0.4 -y stabilized-output.mp4

Crop

ffmpeg -i shaky-input.mp4 -vf vidstabdetect=shakiness=5:accuracy=15:stepsize=6:mincontrast=0.3:show=2 dummy_crop.mp4
ffmpeg -i shaky-input.mp4 -vf scale=trunc((iw*0.90)/2)*2:trunc(ow/a/2)*2 scaled_crop.mp4
@jkalucki
jkalucki / timelapsevideo.md
Last active March 10, 2024 22:52
Creating Timelapse Video From Photos With FFMPEG

Creating Timelapse Video From Photos With FFMPEG

Man, there are a lot of outdated and incomplete tutorials about creating timelapse videos from JPG images and photos. Here's a quick start guide to get going in late 2019.

Software

I'm using ffmpeg version 4.2.1 on MacOS. It is free, well supported, and scales up to practically any number of input images or output video length.

There are a dozen paid timelapse software offerings out there, but I suspect they are just polished front-ends to ffmpeg. Small timelapse videos are possible in iMovie 10.1, but adding even a modest number of images bogs it down badly. The easiest approach is to create a rough lightly compressed video with ffmpeg and then edit the result in iMovie.

Resources

@luipir
luipir / camera_calculator.py
Last active February 29, 2024 16:45
Camera Footprint Calculator
"""
***************************************************************************
camera_calculator.py
---------------------
Date : August 2019
Copyright : (C) 2019 by Luigi Pirelli
Email : luipir at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@nraynaud
nraynaud / dxf_color.cps
Last active February 16, 2022 23:18
A Fusion 360 DXF post processor whose output uses one color per operation, useful for users of Lasercut 5.3. See: https://www.reddit.com/r/ChineseLaserCutters/comments/b793x5/i_improved_the_dxf_post_processor_for_fusion_360/
/**
Copyright (C) 2015-2018 by Autodesk, Inc.
All rights reserved.
Altered by nraynaud
*/
description = "Color AutoCAD DXF";
vendor = "Autodesk/nraynaud";
vendorUrl = "http://www.autodesk.com";
@exussum12
exussum12 / generate.sh
Created July 3, 2018 20:46
FlippingBook to PDF
#!/bin/bash
mkdir -p out
for i in $(seq 1 120); do
page=`printf "%04d" $i`;
wget "https://www.website/files/assets/common/page-html5-substrates/page${page}_4.jpg"
wget "https://www.website/files/assets/common/page-vectorlayers/${page}.svg"
convert -flatten -geometry 1149x2550 -fuzz 10% -transparent white -density 400 page${page}_4.jpg $page.svg out/$page.pdf
@jkjung-avt
jkjung-avt / openalpr_camera.py
Last active December 20, 2023 20:36
Real-time license plate recognition with 'openalpr' using a video file as input. Please check out my "Building and Testing 'openalpr' on Jetson TX2" post for more information: https://jkjung-avt.github.io/openalpr-on-tx2/
# test_camera.py
#
# Open an RTSP stream and feed image frames to 'openalpr'
# for real-time license plate recognition.
import numpy as np
import cv2
from openalpr import Alpr