Skip to content

Instantly share code, notes, and snippets.

@ggarnier
ggarnier / ffmpeg.sh
Last active November 18, 2022 13:52
ffmpeg commands
View ffmpeg.sh
# Adding blurred boxes
# - build a layer called b0, a blurred box with size 100x50 and offset 600x50, between 23s and 31s
# - build a layer called b1, a blurred box with size 300x80 and offset 190x270, between 37s and 49s
# - merge the original video and b0 on ovr0
# - merge ovr0 and b1 to build output
ffmpeg -i input.mp4 -filter_complex \
"[0:v]crop=100:50:600:150,boxblur=10:enable='between(t,23,31)'[b0]; \
[0:v]crop=300:80:190:270,boxblur=10:enable='between(t,37,49)'[b1]; \
[0:v][b0]overlay=600:150[ovr0]; \
[ovr0][b1]overlay=190:270[output]" \
@ggarnier
ggarnier / clean_bash_history.py
Created May 7, 2021 12:44
Remove duplicates from .bash_history
View clean_bash_history.py
# This script removes duplicate lines from .bash_history file.
# It preserves the order from the latest usage of each command,
# to make it easier to search with ctrl+r
from os import path
bash_history_path = path.expanduser("~/.bash_history")
with open(bash_history_path, "r") as f:
lines = f.readlines()
@ggarnier
ggarnier / gist:51bc2f10ff991af5d97a
Created December 18, 2015 15:23
Lista de profissões
View gist:51bc2f10ff991af5d97a
acionista
acompanhante
acordeonista
açougueiro
acrobata
acupunturista
adivinho
administrador
advogado
aeromoça
@ggarnier
ggarnier / gist:fc306a58d9c6ec185545a3d944c9b8a3
Last active April 8, 2019 14:37
Adicionar certificados digitais da Receita Federal no Ubuntu
View gist:fc306a58d9c6ec185545a3d944c9b8a3
sudo mkdir -p /usr/share/ca-certificates/extra
for f in *.cer; do mv $f ${f%.*}.crt; done
sudo mv *.crt /usr/share/ca-certificates/extra/
sudo dpkg-reconfigure ca-certificates
View gist:a35992ac57b0ab97d287d4429594c7cc
# Search available packages with "gimp" in the name or description
apt-cache search gimp
# Check available versions for package "gimp"
apt-cache madison gimp
# Check installed and available versions for package "gimp"
apt-cache policy gimp
# List packages installed via apt
View decompose_number.go
package main
import (
"fmt"
"math"
"os"
"strconv"
)
func main() {
@ggarnier
ggarnier / remove_line.sed
Created January 14, 2016 11:06
Remove line from files using sed
View remove_line.sed
sed -i '' '/expression/d' ./file*
# or, if you have a deep directory tree...
find . -name file* -maxdepth 3 -exec sed -i '' '/expression/d' {} \;
@ggarnier
ggarnier / html2markdown.rb
Created December 18, 2013 14:46
html2markdown
View html2markdown.rb
text.gsub(/<a href="([^"]*)">([^<]*)<\/a>/, '[\2](\1)')
@ggarnier
ggarnier / ordering.rb
Created November 21, 2013 18:03
Ordering an array in Ruby using 2 sorting criterias
View ordering.rb
# Ordering a list by field1 in descending order. If two elements have the same value, order by field2 in ascending order
list.sort do |a, b|
comp = (b.field1 <=> a.field2)
comp.zero? ? (a.field2 <=> b.field2) : comp
end
@ggarnier
ggarnier / private.js
Last active December 25, 2015 16:39
Javascript private functions
View private.js
// Reference: http://javascript.crockford.com/private.html
Test = function() {
function private() {
return "private";
}
return {
public: function() {
return private();
}