Skip to content

Instantly share code, notes, and snippets.

View hrpunio's full-sized avatar

tomasz przechlewski hrpunio

View GitHub Profile
#!/usr/bin/perl
# Compute time offset between digital camera time and GPS time (in seconds)
# Usage exif_datetime.pl -f picture [ -t gps_display_time ] [ -o gps_offset ]
# Where: gps_display_time - gps_offset = gps_internal_time
# And: time_offset = gps_internal_time - $camera_time
#
# Use following format for time-related parameters:
# gps_display_time = hh:mm:ss ; gps_offset = seconds
#
# My GPS for example uses GMT internally and diplays local time.
#!/bin/bash
# *** Zaladowanie pliku GPX do garmina ***
#
# Trasa z http://www.gmap-pedometer.com/ ma nieokreslona nazwe:
# <name>Gmaps Pedometer Route</name>
# Przed zaladowaniem nalezy to recznie poprawic bo inaczj sie zle
# wyswietla w Garminie
grep Pedometer $1 > /dev/null
if [ $? == 0 ] ; then
@hrpunio
hrpunio / gist:1557215
Created January 3, 2012 22:11
Printing every paragraph at separate page vertically centered
%% every par is printed at separate page and centered vertically (Plain.tex)
\let \TruePar \par
\def\eject{\TruePar\break}
\def\par{\TruePar \vfill \eject}
\topskip=0pt plus 1fill
Pierwszy akapit i~pierwsza strona
Drugi akapit i~druga strona
#!/usr/bin/perl
# http://search.cpan.org/~waltman/Geo-Coordinates-DecimalDegrees-0.05/DecimalDegrees.pm
use Geo::Coordinates::DecimalDegrees;
#
my @dms = @ARGV ;
print STDERR "*** dms2decimal hr min sec ... hr/min/sec niekoniecznie sa liczbami calkowitymi....\n";
while (@dms) {
$deg = shift @dms ; $min = shift @dms ; $sec = shift @dms ;
printf "%f %f %f = %.6f\n", $deg, $min, $sec, dms2decimal($deg, $min, $sec);
#!/bin/bash
#
# Usage: ffmpeg_cut.sh start-time stop-time file-in file-out
# where:
# start-time stop-time has the format: hh:mm:ss (hh,mm optional)
#
function cnt_sec () {
echo $1 | awk -F":" '{ if (NF>2) { sec += 60*60 * $(NF-2) } ;
if (NF>1) { sec += 60 * $(NF-1) } ;
if (NF>0) { sec += $NF } ; ## seconds
#!/usr/bin/python
# Wysłanie 4 argumentów wywołania programu do arkusza na Google docs
#
import re
import sys
import time
import datetime
import gspread
# ===========================================================================
@hrpunio
hrpunio / gist:5429300
Created April 21, 2013 11:28
Search for $TSlimit timestamps from GPX track
#!/usr/bin/perl
# Wyszukuje $TSlimit punktów na śladzie GPX najbliższych latitude:longitude
# Ślad jest podany jako argument polecenia
#
use Geo::Distance;
use Getopt::Long;
my $geo = new Geo::Distance;
my $TSlimit = 20;
@hrpunio
hrpunio / gist:5429346
Last active December 16, 2015 11:39
Add sped to subtitle file created with gpsbabel
#!/usr/bin/perl
#
use Geo::Distance;
my $geo = new Geo::Distance;
my $trkpt = 0;
while(<>) {
if (/Lat=/ && /Lon=/) {##
@hrpunio
hrpunio / gist:5436746
Created April 22, 2013 17:04
Scan 1 page with desktop scanner (without running Xsane)
#!/bin/bash
# scan documents to PDF
# t.przechlewski // 2013
#
XSIZE=210
YSIZE=297
MODE="Gr"
RESOLUTION=150 # try "lin", "bin", "gr", or "col"
USAGE="*** $0 -x XSIZE -y YSIZE -mode [lin|gr|col] -r RESOLUTION out-file.pnm
#!/usr/bin/awk -f
# Podsumowanie gw. kategorii
# Wykonanie awk -f foo2.awk co='wartosc' plik
#
BEGIN {
sub("^:","#>", co); sub(":$","#<", co);
gsub(":",":[^:]*:", co);
sub("^#>",":", co); sub("#<$",":", co);