Online Split GPX
http://iamdanfox.github.io/gpxsplitter/
GPS Visualizer. Draw GPX Map. Draw elevation profile
http://www.gpsvisualizer.com/
martes, 16 de mayo de 2017
lunes, 15 de mayo de 2017
php_highligh
highlight html/php code coloring
php_highligh/index.php
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
// 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
viernes, 5 de mayo de 2017
webserver tomcat check nrpe nagios
#!/usr/bin/php
ini_set('default_socket_timeout', 10);.
date_default_timezone_set('Africa/Lagos');
$url = 'http://3.1.1.137/test/webliq/main1.jsp';
$data = array('cuil' => 'user', 'password' => 'psswrd', 'Submit2' => 'ENTRAR', 'vorigen' => 'B');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$date = new DateTime( 'NOW' );
$result = @file_get_contents($url, false, $context);
$date2 = new DateTime( 'NOW' );
$s= (int)$date2->getTimestamp() - $date->getTimestamp();
if ($result === FALSE).
$state="CRITICAL";
if ($s<6 p="" state="OK">
$resp="TOMCAT17 $state - time= $s segundos\n\n";
echo $resp;
switch ($state) {
case $state=='OK': exit(0);
case $state=='WARNING': exit(1);
case $state=='CRITICAL':
shell_exec('/usr/local/bin/tomcat-restart');
exit(2);
}
?>
6>
ini_set('default_socket_timeout', 10);.
date_default_timezone_set('Africa/Lagos');
$url = 'http://3.1.1.137/test/webliq/main1.jsp';
$data = array('cuil' => 'user', 'password' => 'psswrd', 'Submit2' => 'ENTRAR', 'vorigen' => 'B');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$date = new DateTime( 'NOW' );
$result = @file_get_contents($url, false, $context);
$date2 = new DateTime( 'NOW' );
$s= (int)$date2->getTimestamp() - $date->getTimestamp();
if ($result === FALSE).
$state="CRITICAL";
if ($s<6 p="" state="OK">
$resp="TOMCAT17 $state - time= $s segundos\n\n";
echo $resp;
switch ($state) {
case $state=='OK': exit(0);
case $state=='WARNING': exit(1);
case $state=='CRITICAL':
shell_exec('/usr/local/bin/tomcat-restart');
exit(2);
}
?>
6>
Suscribirse a:
Entradas (Atom)