Skip to content

Instantly share code, notes, and snippets.

View hrpunio's full-sized avatar

tomasz przechlewski hrpunio

View GitHub Profile
@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);
@hrpunio
hrpunio / tcx2gpx
Created July 24, 2013 09:46
Convert TCX (Garmin Edge) to GPX with gpsbabel
#!/bin/bash
# Convert TCX (Garmin Edge) to GPX with gpsbabel
# Usage: tcx2gpx tcx-file-name [-o gpx-file-name] -max 999
# -o -- gpx-file-name, if not given, computed from tcx-file-name (it is assumed YYYY-MM-DD*.tcx)
# -max -- produce simplified track with maximum 999 trkpoints
#
SIMPLIFY=""
if [ $# -eq 0 ]; then
#!/bin/bash
#returns source image location and thumbnail location
#Usage: picasa.sh /path/to/pic [Pic Name Shown In Album]
# One have to declare ALBUM_ID USER_ID username and password
ALBUM_ID=????????????????????
USER_ID=116390720146821374745
my_pic="$1"
[ -z "$2" ] &&
@hrpunio
hrpunio / picasa_upld.sh
Created September 11, 2013 13:52
Upload pic_file to Google photos/Picasa with curl; returns source image URL
#!/bin/bash
# Upload pic_file to Google photos/Picasa with curl; returns source image URL
#
# Usage: picasa.sh -s SCALE -a ALBUMID -t PIC_NAME -u -r pic_file
# -s SCALE -- scale pic_file to SCALE% (with imagemagic's convert)
# -a ALBUMID -- if not given upload to default album
# -t PIC_NAME -- picture name, if not given the same as pic_file
# -u -- print HTML fragment with URL to pic_file
# -r -- remove scaled pic_file
#
@hrpunio
hrpunio / gpx2kml.pl
Created September 11, 2013 13:54
GPX track to KML conversion
#!/usr/bin/perl
#
# GPX track to KML conversion
use Getopt::Long;
my $color="ff0000ff";
my $number_w_sign="[\+\-]?[0-9\.]+";
my $quote_sign="[ \t]*[\"'][ \t]*";
my $segment = '';
my $kml_name='??????';
#!/usr/bin/perl
# Get content of SET or Pool
#
use Flickr::API;
use Compress::Zlib;
use Getopt::Long;
use XML::DOM;
require 'login2flickr.rc';
#!/bin/bash
MY_PIC="$1" ## filename of the picture to upload ##
ALBUM_ID=6008849823888405298 # ID of picasaweb album
PIC_TITLE=`basename $MY_PIC` # filename w/o extension
PIC_TYPE=`file -b --mime-type "$MY_PIC"`
ACCESS_TOKEN=$(oauth2picasa.py) ## Acces token is managed with Python's script now
## Note that ALBUM_XML URL starts now from https:// now
ALBUM_XML="https://picasaweb.google.com/data/feed/api/user/$USER_ID/albumid/$ALBUM_ID"