Skip to content

Instantly share code, notes, and snippets.

View aadm's full-sized avatar

Alessandro Amato del Monte aadm

View GitHub Profile
@aadm
aadm / sportlog.md
Last active April 29, 2021 14:29
Script to analyse sport activity log created with jrnl

This Python script is meant to be run on a journal file created with jrnl.sh where I log all my sports activities.

For example, if today I've run 7km in 40 minutes:

$ jrnl 40m 7km @CORSA

If I forgot to add last Sunday's bike ride and yesterday's run:

@aadm
aadm / resolve-transcode.sh
Created November 16, 2020 10:24
Bash script to transcode video and audio clips to Davinci Resolve accepted codec.
#!/bin/bash
#-------------------------------------------------------------------------------------
# Convert all clips in a directory to Davinci Resolve compatible format.
# Will work on both audio and video files.
# Creates two subdirectories in current directory:
# - ORIGINAL (where the input files will be moved after conversion)
# - TRANSCODED (where the converted files will be created)
#
# Originally I used as output format prores which made the script much
# simpler but the output files were massive. I then switched to DNxHD/DNxHR format
@aadm
aadm / 2019-04-08_imola_aprilia.md
Last active April 11, 2019 08:25
Racconto del trackday Aprilia ad Imola, 8 Aprile 2019

LA MOTO

Quattro cilindri a V di 65 gradi, duecentodiciassette cavalli all'albero, cambio elettronico con doppietta gasante in scalata, freni Brembo che sembrano quelli da MotoGP, sospensioni Ohlins, scarico Akrapovic in carbonio, alette aerodinamiche e prese d'aria sul piedino forcella per raffreddare le pinze freno. Solo a scrivere tutti questi dettagli uno appassionato di moto non puo' far altro che provare un piacere viscerale.

Poi le senti sul rettilineo di Imola (che tanto rettilineo non e') e anche guidate da mezzeseghe qualsiasi sembrano dei prototipi con un sound pazzesco, travolgente, terrificante quando poi ti ci metti su la prima volta e apri il gas.

Quando poi ci monti su, senti una moto rigida, corta, leggera, compatta (il plexiglass fin troppo piccolino! sarebbe buono avere una doppia bolla come quelle che usava Bayliss sulle 998/999 SBK, adesso pare che non vadano piu' di moda ma io ne avrei giovato).

Apri il gas in seconda e terza e la moto non ne vuole sapere di stare giu'! Tanto che

@aadm
aadm / python_miniconda_squit_install.md
Last active March 27, 2019 14:15
Python via miniconda and squit installation

How to install Python via Miniconda and squit for dummies.

Install miniconda: https://docs.conda.io/en/latest/miniconda.html

Start menu/anaconda (if on Windows), launch anaconda prompt.

Execute following commands to install all required libraries and extras:

conda install numpy scipy pandas matplotlib jupyter scikit-learn

pip install bruges lasio segyio

@aadm
aadm / sinc_gdrive.sh
Created April 18, 2018 14:56
Google Drive sync with rclone
#!/bin/bash
# script to sync Google Drive with local folder using rclone
# modified from initial version that used rsync and a usb disk
# by default will write log to home directory with name sinc_gdrive_log.txt
# check also exclusion list
# usage:
#
# $ sinc_gdrive.sh [command]
#
@aadm
aadm / italian_photographers_otp.md
Last active May 25, 2018 10:35
Italian photographers suggestions for On Taking Pictures.

In 2014 and in 2017 I sent two emails to OTP suggesting a few italian photographers. In one episode (I think end-2016/2017) Bill & Jefferey actually talked about another photographer which I also enjoy, Luigi Ghirri, so I thought hey, it's the moment to remind them about other italian photographers!

I have condensed and edited the text written in those emails in this gist.

In this latest edit I have expanded the section on Alex Majoli and added a fourth photographer, who happens to be a dear friend of mine and the antithesis of the accomplished/professional photographer, Dylan Kier.

Cito

@aadm
aadm / jefferey_ffmpeg_recipe.md
Last active February 22, 2018 20:40
Jefferey's ffmpeg recipe.

This is a little help given to Jefferey, co-host of the OTP podcast which I follow since its beginning. Yesterday he sent out a tweet asking for help on something that I knew it could be solved with the power of open source. I hope everything is clear and work as intended. If it does, I'd like for Jefferey to check my suggestions for italian photographers to be featured on OTP! (aadm 22-Feb-2018)

get ffmpeg

First step, get ffmpeg on your Mac.

I recommend brew but other options exist. If you don't have brew, then install this one first (it's a powerful package manager to get all sort of cool open source, unix-like apps on Mac). Instructions are on the website or simply input this at the terminal:

$ /usr/bin/ruby -e "$(curl -fsSL https:

@aadm
aadm / heartrate_comparison.py
Last active September 29, 2017 21:50
Little hack scripts to compare heartrate measurements from Polar and Garmin.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import pandas as pd
import os
# (1) Garmin Connect: export gpx
# (2) convert gpx with heartrate_comparison_dataprep.sh <file.gpx>
# (3) Polar Flow: export csv
@aadm
aadm / batch_create_movie_from_sequence.sh
Last active March 8, 2020 19:02
Creating movies from an image sequence with ffmpeg
# execute with `sh script.sh`
DIR=/Users/alex/Pictures/sequence
for i in $DIR/*_BURST000.jpg
do
TMP=`basename ${i} .jpg`
IN=${TMP%???}
OU=`echo ${TMP} | cut -d'_' -f3`
echo "create video from sequence starting with ${IN}, output to ${TMP}.mp4"
@aadm
aadm / example_plot3dseis.py
Last active September 22, 2021 19:03
Python function to plot inline, crossline or horizontal slice from 3D seismic volume. Also included example showing how to load a 3D cube and display it.
import numpy as np
import matplotlib.pyplot as plt
import time
from obspy.io.segy.segy import _read_segy
# sample 3d cube from GOM, download here:
# https://walrus.wr.usgs.gov/namss/survey/b-05-88-la/
filename='G3D1304_005_L88_056_LN_1664-3428.sgy'
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~