Skip to content

Instantly share code, notes, and snippets.

@ggarnier
ggarnier / ffmpeg.sh
Created Sep 13, 2019
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]" \
View shutdown.sh
#!/bin/bash
NODE_NAME=$(hostname)
GRACE_PERIOD=${GRACE_PERIOD:-0}
curl -X POST \
--data-urlencode "payload={\"text\": \"[$(date +"%F %T")] ${NODE_NAME} starting kubectl drain with grace period ${GRACE_PERIOD} seconds\"}" \
https://hooks.slack.com/services/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
output=$(kubectl --kubeconfig /tmp/.kube/config drain ${NODE_NAME} --force --ignore-daemonsets --delete-local-data --grace-period=${GRACE_PERIOD} 2>&1 | sed 's/\"/\\"/g')
curl -X POST \
--data-urlencode "payload={\"text\": \"[$(date +"%F %T")] ${NODE_NAME} finished kubectl drain: status $?:\n${output}\"}" \
View startup.sh
#!/bin/bash
NODE_NAME=$(hostname)
curl -X POST \
--data-urlencode "payload={\"text\": \"[$(date +"%F %T")] ${NODE_NAME} starting kubectl uncordon\"}" \
https://hooks.slack.com/services/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
mkdir -p /tmp/.kube/
curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-ca -o /tmp/.kube/ca.pem
@ggarnier
ggarnier / gist:fc306a58d9c6ec185545a3d944c9b8a3
Last active Apr 8, 2019
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 Jan 14, 2016
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' {} \;
View gist:51bc2f10ff991af5d97a
acionista
acompanhante
acordeonista
açougueiro
acrobata
acupunturista
adivinho
administrador
advogado
aeromoça
@ggarnier
ggarnier / x11docker.sh
Created Sep 29, 2015
Run graphical applications in Docker containers in OSX
View x11docker.sh
# https://github.com/docker/docker/issues/8710#issuecomment-72669844
# display IP address isn't boot2docker ip, it's the address from vboxnet0 (run `ifconfig`)
brew install socat
brew cask install xquartz
open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
# in another window
docker run -e DISPLAY=192.168.59.3:0 jess/geary
@ggarnier
ggarnier / find_replace.sed
Last active Sep 3, 2015
Find/replace in multiple files
View find_replace.sed
oldstring="describe"
newstring="RSpec.describe"
path=path/to/files
grep -rl $oldstring $path/* | xargs sed -i '' s/$oldstring/$newstring/g
You can’t perform that action at this time.