Skip to content

Instantly share code, notes, and snippets.

@mluis7
mluis7 / convert-srt-fps.sh
Last active April 12, 2024 16:51
Convert srt subtitle file timestamps from NTSC 23.976 fps to PAL 25 fps and viceversa
#!/bin/bash
#
# Convert srt subtitle file timestamps from NTSC 23.976 fps to PAL 25 fps and viceversa
# A typical srt subtitle frame looks like
#
# 1
# 00:02:13,720 --> 00:02:16,644
# - ¿Cariño?
# - Hola.
@mluis7
mluis7 / merge-sync-srt-subtitles.sh
Created April 12, 2024 00:11
Apply and synchronize 2 srt subtitle files to a single video
#!/bin/bash
readme=$( cat <<README
Problem:
How to apply and synchronize 2 srt subtitle files made for CD release to a single video ripped from DVD/BluRay.
No fps conversion so subtitles and video must have same fps (23.976, 25, whatever)
1 ~2h video ripped from DVD or BlueRay
2 subtitles files for CD box release of same movie.
@mluis7
mluis7 / daytime_by_latitude.py
Last active April 8, 2024 02:26
Horas de luz por latitud (Daytime by latitude)
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
import math
'''Horas de luz por latitud.
Valores para Mendoza, Argentina; año 2024.
Cambiando los valores de diccionario dlatitudes se puede usar para cualquier lugar de la tierra.
Cambiar también loc1, loc2 con keys a destacar de dlatitudes (horas max/min, equinoccios y solsticios).
Genera dos imágenes png; uno con curvas de horas por latitud y otro de isócronas por latitudes.
Las latitudes en dlatitudes deben ser de punto flotante con 4 decimales.
@mluis7
mluis7 / palindrome_dates.sh
Last active February 22, 2022 18:36
Palindrome dates since year 1001 - dd-mm-yyyy format
#!/bin/bash
y="1001"
for i in $(seq 1001 2153); do
y="$i"
m=$(echo "${y:0:2}" | rev)
d=$(echo "${y:2:2}" | rev)
rv=$(echo "$d$m" | rev)
if [ "$d" -le 31 ] && [ "$m" -le 12 ] && [ "$rv" == "$y" ]; then
@mluis7
mluis7 / chrome_persistent_logs.txt
Last active July 2, 2018 01:14
Automate keystrokes to set chrome with persistent logs on Network tab.
Automate keystrokes to open URL in Chrome with persistent logs on Network tab.
Tested with Chrome 66.
A funny workaround to save time while using Chrome dev tools:
* Make sure xdotool is installed
* Launch chrome
* Put the code below in a bash script chrome_auto.sh to send all the keys to: open a tab, dev tools, settings, set 'persistent logs', type the URL and hit enter.
#!/bin/bash