Skip to content

Instantly share code, notes, and snippets.

View andreagalle's full-sized avatar
💭
Whatever Works - Basta che funzioni

Andrea Gallegati andreagalle

💭
Whatever Works - Basta che funzioni
View GitHub Profile
@andreagalle
andreagalle / pre-push.sh
Created May 7, 2019 13:12 — forked from vlucas/pre-push.sh
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
@andreagalle
andreagalle / vtk-unstructured-grid-plot.py
Created May 10, 2019 07:33 — forked from mrklein/vtk-unstructured-grid-plot.py
Read, cut and plot VTK file with python-vtk and matplotlib
%matplotlib inline
filename = 'vtk-plot_0.vtk'
import vtk
from numpy import zeros
import matplotlib.pyplot as plt
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(filename)
@andreagalle
andreagalle / .vimrc
Created September 29, 2019 09:00 — forked from Sharpie/.vimrc
A vim profile file designed for editing Fortran source code
" Ensure correct syntax highlighting and auto-indentation for Fortran free-form
" source code.
let fortran_free_source=1
let fortran_do_enddo=1
filetype plugin indent on
syntax on
" Turn on line numbers and row/column numbers.
set nu
@andreagalle
andreagalle / README-Template.md
Created February 25, 2020 19:03 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@andreagalle
andreagalle / stereo2monoMP4
Last active March 13, 2020 20:49
Given an MP4 video, merges two audio tracks into one, without re-encoding the video
#!/bin/bash
#ffmpeg -i $1 -strict -2 -filter_complex "amerge,pan=stereo:c0<c0+c2:c1<c1+c3" mono_$1
ffmpeg -i $1 -filter_complex "amerge,pan=stereo|c0<c0+c2|c1<c1+c3" -vcodec copy mono_$1
@andreagalle
andreagalle / convert_mov2mp4
Created April 12, 2020 00:56
convert .mov video to .mp4 with ffmpeg
ffmpeg -i $1.mov -vcodec h264 -acodec aac -strict -2 $1.mp4
@andreagalle
andreagalle / toctoc.sh
Created April 13, 2020 17:56
How to recursively find and list the latest modified files in a directory with subdirectories and times?
#!/bin/bash
stat --format %y $(ls -t $(find $1/ -type f) | head -n 1)
du -hs * | sort -h
ffmpeg -i $1.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" -c:v pam -f image2pipe - | convert -delay 10 - -loop 0 -layers optimize $1.gif
@andreagalle
andreagalle / bkp-flu9
Created April 19, 2020 01:59
backup from flu9 to current directory
rsync -vaPuz -e 'ssh -p 2009' gallegati@flumacs.dima.uniroma1.it:/home/gallegati/FTaC-pp/cyclone-pijet-omp .