Skip to content

Instantly share code, notes, and snippets.

View aardbol's full-sized avatar
🎯
Focusing

Leonardo aardbol

🎯
Focusing
View GitHub Profile
@aardbol
aardbol / aws_ec2.yml
Last active September 4, 2024 14:44
Ansible SSH connections via AWS EC2 Instance Connect Endpoint
# The dynamic inventory
# https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html
plugin: amazon.aws.aws_ec2
profile: "{{ lookup('env', 'AWS_PROFILE') | default('aws_profile', true) }}"
regions:
- ap-northeast-1
- eu-central-1
cache: True
cache_timeout: 600
@aardbol
aardbol / ffmpeg.txt
Last active March 19, 2024 17:13
ffmpeg examples
# Add a subtitle to a video, set the language=eng, make it the default subtitle and store it as mkv
# $1 = video file, $2 = subtitle file
ffmpeg -i "$1" -i "$2" -map 0 -map 1 -metadata:s:0 language=eng -c copy -disposition:s:0 default "$1.mkv"`
# Add a subtitle to a video, copy just one audio stream, set metadata language=eng for the subtitle, make it the default one and store it as mkv
ffmpeg -i "$1.mp4" -i "$1.srt" -map 0 -map 1 -map -0:a:0 -c copy -metadata:s:s:0 language=eng -disposition:s:0 default "$1.mkv"
# Scale down every file to H265 720p using Intel QSV hardware encoding
find . -type f -exec ffmpeg -i {} -c:v hevc_qsv -s 1280x720 -global_quality 20 -c:a copy -c:s copy {}.mkv \; && find . ! -name '*.mkv.mkv' -exec rm {} \; && rename 's/.mkv.mkv/.mkv/' *
@aardbol
aardbol / renewcert.sh
Created October 11, 2021 17:12
Let's Encrypt certificate generation with OVH DNS & Nginx
#!/bin/bash
# Assuming you've configured your nginx config:
# ssl_certificate /etc/letsencrypt/live/[domain]/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/[domain]/privkey.pem;
#
# Change the variables between [] and add your OVH API keypair
export OVH_AK=""
export OVH_AS=""
@aardbol
aardbol / nginx.conf
Created February 7, 2017 18:54 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048