Skip to content

Instantly share code, notes, and snippets.

View hrpunio's full-sized avatar

tomasz przechlewski hrpunio

View GitHub Profile
@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
library("ggplot2")
library("ggpubr") ## for ggarrange
library("dplyr")
df <- data.frame(
ab = c(10, 10, 10, 20, 15, 20),
as = c(12, 15, 18, 18, 12, 30),
branch = c('S', 'M', 'D', 'CS', 'IT', 'A')
)
@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
#
#!/usr/bin/perl
# Get content of SET or Pool
#
use Flickr::API;
use Compress::Zlib;
use Getopt::Long;
use XML::DOM;
require 'login2flickr.rc';
@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='??????';
#!/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" ] &&
#!/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 / 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
@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: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;