Skip to content

Instantly share code, notes, and snippets.

private GPSPoint gpsCentre(Collection<GPSPoint> points) {
float x = 0;
float y = 0;
float z = 0;
for(GPSPoint pt : points) {
final float lat = (float) pt.getLatitude();
final float lon = (float) pt.getLongitude();
x += Math.cos(lat) * Math.cos(lon);
@Firzen7
Firzen7 / gif_creator.sh
Created October 9, 2020 14:03 — forked from cachapa/gif_creator.sh
Shell script to generate high-quality animated gifs from a video file
#!/bin/bash
# Based on http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
# Requires ffmpeg
filename="${1%.*}"
palette="/tmp/palette.png"
filters="scale=320:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$filename.gif"