Friday, November 26, 2021

 Strava GPX export and how to fix times


If you are on Strava you can usually not easily download gpx track from your friends without being a subscriber. There exits browser extensions fro chrome or firefox that can help you with that.


What I noticed however is that the timestamps within such exported track are based on Unix epoch.

In addition the whole file usually comes without end-of-line characters.

To fix the latter first you can use gpsbabel and use 'gpx' for input  as well as for output type. This literally will reformat the gpx to make it better readable in you favorite editor (mine is emacs btw).

$ gpsbabel -i gpx -f 1234.gpx  -o gpx -F 1234_babel1.gpx


I also found that the first trackpoint was without a timestamp, so you might want to fix it or just delete this trackpoint.

As an example it might look like this:


      <trkpt lat="50.144884000" lon="5.718563000">
        <ele>378.000</ele>
        <time>1970-01-01T00:00:01Z</time>
        <extensions>
          <gpxtpx:TrackPointExtension>
            <gpxtpx:hr>94</gpxtpx:hr>
            <gpxtpx:atemp>22</gpxtpx:atemp>
          </gpxtpx:TrackPointExtension>
        </extensions>
      </trkpt>

As you can see the time starts at unix epoch (Zulu).

To fix this note down the real ZULU time when the run happend (in Strava that is shown for that activity). Let say that run started at 6:00 PM on Friday, February 21, 2020 then we can get the epoch offset (seconds after epoch) like this:

$ date --date='02/21/2020 17:00:00Z' +"%s"
1582304400

Now use gpsbabel to add the offset, of course you can directly work on the original file skipping the first step above to just re-write the same file with newlines:


$ ./gpsbabel/gpsbabel -i gpx -f 1234_babel1.gpx -x track,move=+1582304400s  -o gpx -F 1234_babel2.gpx 

... so why you want to do this??? In my case I wanted to create an animation with two gpx tracks where one was my run and the other was from someone else (being on Strava as well) so to correlate the times we need to fix either my track (since it has correct timestamps, we could normalize to epoch) or do what is described here.

Then you use https://gpx-animator.app/  to generate a video file like this  one:  LegendsTrail_GPX-Animation.mp4


Tuesday, October 5, 2021

 # OpenRazer on RedHat 8.4

## building rpm

Basically follow the steps for Fedora listed here: https://github.com/openrazer/openrazer/wiki/Building-a-package

Steps

sudo dnf install rpm-build rpmdevtools

rpmdev-setuptree

cd ~/rpmbuild/SPECS

curl -O https://raw.githubusercontent.com/openrazer/OBS-packaging/master/openrazer.spec

# To build from custom sources, pause here to edit openrazer.spec:

# Replace the line with "#define gitcommit" with "%define gitcommit $yourcommit"

# Optionally you will have to edit the first "Source0:" line to point to a different repository than openrazer/openrazer.

spectool -g -R openrazer.spec

sudo dnf -y builddep openrazer.spec

rpmbuild -bb openrazer.spec

sudo dnf install ../RPMS/noarch/*.rpm

Issues

I have python 3.6 amd 3.8 installed, rpmbuild took wrong version in order to fix this add this define to override python_sitelib:

%define python3_sitelib /usr/lib/python3.8/site-packages

in addition I used the latest git commit hash from main (check yourself):
#define gitcommit 7c353f9c8f1439bce5396218331c412eae0c2563

I could not find a python3-daemonize package in redhat yum repository. But that does not matter, actually I  think I do not need the daemon anyway. Most frontends only require the driver. So you could remove that requirement if you want to get it installed then install daemonize via pip3 for example.


xautomation

I created this specfile to build xautomation rpm (again I do not make use of it ... but at that time thought I might require the dependency)


# use spectool to download source:
# spectool -g -R xautomation.spec


%define python3_sitelib /usr/lib/python3.8/site-packages

%define debug_package %{nil}


Name: xautomation

Version: 1.09

Release: 4%{?dist}

Summary: Controls X from the command line and does "visual scraping".

License: GPL-2.0

URL: https://hoopajoo.net/projects/xautomation.html

BuildArch: x86_64

Requires: libXtst-devel

Source0: https://hoopajoo.net/static/projects/%{name}-%{version}.tar.gz

%description
Controls X from the command line and does "visual scraping".


%prep
%autosetup -n xautomation-%{version}

%build
./configure --prefix=$RPM_BUILD_ROOT/usr
make

%install
make install

%files
/usr/bin/*
%{_prefix}/bin/*

%{_mandir}/man1/pat2ppm.1.gz
%{_mandir}/man1/patextract.1.gz
%{_mandir}/man1/png2pat.1.gz

%{_mandir}/man1/rgb2pat.1.gz|
%{_mandir}/man1/visgrep.1.gz
%{_mandir}/man1/xmousepos.1.gz
%{_mandir}/man1/xte.1.gz
%{_mandir}/man7/xautomation.7.gz


find keyboard

#!/bin/sh

[ -d /sys/bus/hid/drivers/razerkbd ] || exit 1

device=$(find -H /sys/bus/hid/drivers/razerkbd/0003\:1532\:0241.*/ -type f -name device_type)

device_type=$(cat $device)

device=$(echo ${device%/*})

if [ "Razer BlackWidow 2019" = "$device_type" ]; then

    echo "Keyboard found at: $device"

else

    echo "No Razer Blackwidow found!"

    exit 2

fi


set effects


# echo -n -e "\x03\x00\xFF\xFF" > $device/matrix_effect_reactive
matrix=$1
if [ -z "$matrix" ]; then
    echo "bye"
fi

case $matrix in
"wave")
    echo "setup wave pattern"
    echo -n "1" > $device/matrix_effect_wave
    ;;
"stars")
    echo "setup starlight pattern"
    ;;
"react")
    speed=$2
    color=$3
    if [ -z "$speed" ] || [ -z "$color" ]; then
echo "no speed and color provided using: \"\x03\x00\xFF\xFF\""
echo -n -e "\x03\x00\xFF\xFF" > $device/matrix_effect_reactive
#exit 3
    fi
    echo "setup reactive effect: \"$speed$color\""
    echo -n -e "$speed$color" > $device/matrix_effect_reactive
    ;;
#   *)
#     STATEMENTS
#     ;;
esac



Wednesday, September 6, 2017

Downgrade android app

Just in case you come in some similar situation ...
I had "auto-update" enabled in the Play Store settings on my android phone, so a few days ago the Garmin Connect Mobile app had been updated automatically. So far so good, wasn't for the first time though. But this time this version did not allow re-connection of my Garmin Fenix 3 with the app once the connection was lost (phone off or just out of reach ...). I could not find any other way (like off/on BT or rebooting phone/watch) then going through the process of re-pairing the device :(

But previous version was working just fine and could handle this situation without problems.
So what to do? Either live with it ... yeah could, maybe next update comes soon and will fix the regression. Also I have seen some app that does the re-pairing of the device for you ... well I have not tested it but hard to believe it is much faster than doing it manually. So I thought it might be the best to just install the previous version at it was just working right.

But how?
Well pretty easy actually you just go to a site like: https://www.apkmirror.com/ search for the connect app and download the previous version as .apk file.
Then push to your phone (well if you browser to the site via phone you can skip this of course) eg. via adb push. I removed (aka deinstalled) connect mobile app before (not sure if it would be problematic to keep old version ... maybe not) then enable installation of app from unknown sources in the developer settings on the phone. Browse to the .apk file and press "install" button.
Done open app and login, pair your device and you're good to go.
For now I also disabled "auto update" ;)

Friday, January 6, 2017

Wo lauf ich denn heute ...?

Oder wie finde ich eine neue (Lauf-) Strecke

Gerade hat jemand diesen Link im DC Rainmaker Blog gepostet:
https://www.naviki.org/de/naviki/route-planen/#

In der Vergangenheit hatte ich schon mal etwas ähnliches entdeckt und hatte mir auch schon selbst Gedanken gemacht etwas Vergleichbares zu basteln ...

Worum geht's eigentlich? ... ganz einfach, ich will laufen ... so ca. 30km oder heute vielleicht auch mal 60k, aber weiss nicht wo lang!
Also ... man braucht ein tool, dem man sagt ich will ca. 30k laufen, mach mal ein paar Vorschläge.

Genau das kann man auf der naviki seite oben tun!

Das sieht dann erstmal so aus:



Von hier klickt man auf das "Round-Trip" Symbol, dann auf der Karte einen Startpunkt suchen und "Rechts-Klick" -> "Von Hier" auswählen (Oder alternativ Straße, Ort eingeben).  Danach wurde bei mir schon eine Strecke angezeigt (default 50k, Alltag). Damit es auch Spass macht sollte man auf jeden Fall auch auf "Mountainbike" klicken und ggf. über den Schieber die gewünschte (ca.) Distanz variieren. Dann kann man mit Klicks auf die Pfeile (unter der Streckenlänge) verschiedene Strecken "durchscrollen".

Ueber das kleine Menufeld rechts oberhalb des Höhenprofils, kann man die Strecke auch als gpx speichern.



Also ich find's Cool!

Saturday, October 22, 2016

Umweltpreis ... wer mag darf hier gerne abstimmen:

https://www.swt-umweltpreis.de/profile/landschaftspflege-schaffung-von-biotopen-und-erhalt-von-kleindenkmalen-im-schaichtal/


... worum geht's?

WAS MÖCHTEN SIE MIT IHREM PROJEKT IN DER REGION BEWIRKEN?

Das Prinzip „Schützen durch Nützen“ wird in allen Bereichen des Naturpark Schönbuch angewendet. Natur- und Landschaftsschutz werden parallel zur nachhaltigen Forstwirtschaft und dem sanften Naturtourismus betrieben. Durch die jährlichen Landschaftspflegeaktionen sorgt der Förderverein Naturpark Schönbuch e.V. für die Identifikation seiner Besucher mit ihrer Heimat. Die gemeinsamen Aktionen schaffen ein Bewusstsein für die Natur vor der eigenen Haustüre und das Gefühl, Verantwortung für diese besondere Landschaft zu tragen.

Dem Aufruf zur Teilnahme an der Pflegeaktion folgen seit 25 Jahren viele freiwillige Helfer und Freunde des Naturparks. In der Vergangenheit wurden u.a. Streuobstwiesen gepflegt, die Lindenallee neu bepflanzt, Hecken zurückgeschnitten und wertvolle Talauen im Naturpark von aufkommender Sukzession befreit. Die Aktionen zählen wegen ihrer jahrelangen Kontinuität und dem hohen naturschutzfachlichen Wert neben der Umweltbildung und der Öffentlichkeitsarbeit zu den wichtigsten Aufgaben des Fördervereins.
Bei näherer Betrachtung zeigt sich, dass der Schönbuch aber auch eine unglaubliche Vielzahl von Kleindenkmalen aufweist. Mit seinen Pflegeaktionen trägt der Verein ebenfalls zum Erhalt dieser historisch wertvollen Funde bei und setzt sich dafür ein, den Menschen den Natur- und Kulturraum erlebbar zu machen.

Am 22. Oktober 2016 gilt deshalb unser Einsatz im Landkreis Esslingen der Pflege eines historischen Wanderwegs im Walddistrikt Schaichberg. Damit die kulturgeschichtlich bedeutsamen Denkmale auch zukünftig erhalten bleiben, werden bei der Pflegeaktion historische Tongruben sowie keltische Grabhügel freigeschnitten. Dadurch werden zusätzlich wertvolle Lebensräume für Amphibien wie dem Bergmolch und der Gelbbauchunke geschaffen.
Eine weitere Maßnahme ist das Freistellen eines Steinbruchs. Dieser Eingriff dient neben der Denkmalpflege ebenfalls dem Biotopschutz, indem Lebensräume für Reptilien geschaffen, verbessert und erhalten werden.

WOFÜR WÜRDEN SIE DIE FÖRDERGELDER VERWENDEN?

In erster Linie würden die Fördergelder für die nachhaltigen, jährlich stattfindenden Landschaftspflegeaktionen (Biotopschaffung) verwendet werden. Des Weiteren für waldpädagogische Einrichtungen, Maßnahmen der Öffentlichkeitsarbeit sowie die Neugestaltung des Besucherleitsystems im Naturpark Schönbuch.

Saturday, February 27, 2016

raspi edimax wlan

WLAN on raspberry pi with edimax usb adapter


Installed new NOOBS on a raspi that was laying around on my desk ... 
I went for a headless aka silentinstall installation. The raspi still had some EDIMAX wireless usb adapter installed.


Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

So ... that little thing worked before ... pretty sure about that. Now I did not get wifi connection to my access point :(

Some of the strange log messages include:

$ sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/example.conf
Successfully initialized wpa_supplicant
nl80211: Driver does not support authentication/association or connect commands

wlan0: Failed to initialize driver interface

Google says there's others with this issue ... but really it took quite a while to find a working solution ... so what helped me is from this source:
 
 http://ratgeber-community.com/wlan-mit-raspberry-pi-raspbian-und-edimax-ew-7811un-44527d2f

When I ran wpa_supplicant with -dd I was wondering  why my access point got ignored, yes SSID is hidden but so what?

So from the page above the hint was to add stuff to the /etc/network/interfaces
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wpa-ap-scan 1
wpa-scan-ssid 1

wpa-ssid "MYSSID"
wpa-proto RSN
wpa-pairwise CCMP
wpa-key-mgmt WPA-PSK
wpa-psk "mytotallysecurepassphrase"
iface default inet dhcp


The auth stuff and proto and such is actually all in wpa_supplicant.conf as well but for some reason connecting to AP without wpa-ap-scan and wpa-scan-ssid does not work here (anymore).