miércoles, 18 de octubre de 2017

Google Maps timeline 2 (strava | endomondo | etc)

1) download google maps timeline in kml format.

https://www.google.com/maps/timeline?

2) Convert kml 2 gpx

http://www.gpsvisualizer.com/convert_input

3) edit GPX and leave  header gpx and activity

4) calculate speed: km/h= km/(hours*60+minutes)*60

5)Convert plain gpx to timeline gpx
http://gotoes.org/strava/Add_Timestamps_To_GPX.php

6) upload to strava

miércoles, 2 de agosto de 2017

Create MD5 chksum windows & linux

Linux

 md5sum * > checklist.chk

Windows

Total Commander (totalcmd)

Select Files.
Menu Files, Create checksums CRC

lunes, 17 de julio de 2017

whost

#!/bin/bash
ip=$1
nmblookup -A $ip

martes, 16 de mayo de 2017

GPX Tools

Online Split GPX
http://iamdanfox.github.io/gpxsplitter/

 GPS Visualizer. Draw GPX Map. Draw elevation profile
http://www.gpsvisualizer.com/

lunes, 15 de mayo de 2017

php_highligh

highlight  html/php code coloring

php_highligh/index.php

<?php echo '<form method="POST" action="index.php?">
<textarea name="data" style=\'width:550px;height:200px;resize:none;border:4px solid #8f8f8f\'>'
; $data=$_POST['data'];
echo 
htmlentities($data);
echo 
'</textarea><br><input type="submit" name="accion" value="enviar"></form>';
if (
$_POST[accion]=='enviar'){
    
$data=highlight_string($data,true);
    echo 
"<br>$data<br><br>";
    
$data=htmlspecialchars($data);
    
$data="<div style='background:#F5FDF4;padding:6px'>$data</div>";
    echo 
"<textarea cols=80 rows=40>".($data)."</textarea>";
}

gpx_fix_ele_cli.php


fix elevation of gpxfile from another gpx file with barometer
PHP5 CLI version (command line).

gpx_fix_ele_cli.php

#!/usr/bin/php
#fix elevation of gpxfile from another gpx file with barometer
<?php
$file_in
="La_Estancita_Race_2017_.gpx"// gpx to fix $file_in_ok="strava_full_seba.gpx";     // gpx to extract correct elevation $file_out=substr($file_in,0,-4).'_fixed.gpx';

if (!
file($file_in)) {echo "Error\n$file_in no existe.";die;}
if (!
file($file_in_ok)) {echo "Error\n$file_in no existe.";die;}
$gpx1 simplexml_load_file($file_in); $gpx2 simplexml_load_file($file_in_ok);
$i=0;
foreach (
$gpx1->trk->trkseg->children() as $trk1) {
    
$lat = (string) $trk1['lat'];
    
$lon = (string) $trk1['lon'];
    
$ele = (string) $trk1->ele;
    
$name = (string) $trk1->name;
    
$newele=find_ele($lat,$lon);
    if (
$newele) {
<------>
$gpx1->trk->trkseg->trkpt[$i]->ele=$newele;
    }
    
$i++;
}

echo 
"writing $file_out\n"; file_put_contents($file_out$gpx1->asXML());
unset(
$gpx1);
unset(
$gpx2);
die;

function 
find_ele($lat1,$lon1) {
    
$gpx2=$GLOBALS['gpx2'];
    
$newele=false;
    
$mindist=5000;

    foreach (
$gpx2->trk->trkseg->children() as $trk2) {
<------>
$lat2 = (string) $trk2['lat'];
<------>
$lon2 = (string) $trk2['lon'];
<------>
$grados rad2deg(acos((sin(deg2rad($lat1))*sin(deg2rad($lat2)))+
<------><------>(
cos(deg2rad($lat1))*cos(deg2rad($lat2))*cos(deg2rad($lon1-$lon2)))));
<------>
$d round($grados 111133.84,6);
<------>if (
$d<$mindist) {
<------>    
$mindist=$d;
<------>    
$newele=(string) $trk2->ele;
<------>}
    }
    echo 
".";
    return 
$newele;
}

miércoles, 10 de mayo de 2017

simple log remote host dynip's

puship.php



//  simple log remote host dynip's
//  http://server/puship/puship.php?host=xx33ss
//  http://server/puship/puship.php?host=xx33ss&ip=6.6.6.6

$validhosts=array("xx33ss","mt55kdc","d55c");

$host=$_GET['host'];
$ip=$_GET['ip'];

file_put_contents("1.txt",'_'."$host.txt");

if (in_array($host,$validhosts)) {
    file_put_contents("$host.txt",$_SERVER['REMOTE_ADDR']. ' '.$_GET['ip']  .date(" Y-m-d H:i:s"));
}




in server with dinamic ip

/etc/cron.hourly
push_ip.sh

lynx  -dump http://7.7.7.7/puship/puship.php?host=xx33ss

or /etc/crontab
19 *<-->* * *  root  /usr/bin/lynx  -dump http://181.15.95.123/puship/puship.php?host=xx33ss >/dev/null


the script  create this file:
http://7.7.7.7/puship/xx33ss.txt