Skip to content

Instantly share code, notes, and snippets.

@waywardone
waywardone / renameGarminFIT.sh
Last active September 14, 2018 04:03
Garmin FIT filename decoding
#!/bin/bash
# The following is from the Garmin forums: https://forums.garmin.com/forum/garmin-express/garmin-express-pc/76831-
# The Garmin Forerunner 220 and 620 (FR220 and FR620) save their activity
# files with a cryptic name on the watch. Based on Jeff Pethybridge's
# (ZUKJEFF) analysis and my own findings, these would be the filename codes:
#
# Example: 43S64121.FIT
#
# Char 1 is year: 3 (2013), 4 (2014) ... Will clash in ten years time!
@waywardone
waywardone / races.csv
Last active September 14, 2019 07:39
id state county distance total_distance
06041 California Marin 13.1 49.1
41005 Oregon Clackamas 10 10
53033 Washington King 13.1 13.1
48201 Texas Harris 5 5
06075 California San Francisco 23 49.1
06085 California Santa Clara 5 49.1
06081 California Sa Mateo 8 49.1
@waywardone
waywardone / createEmptyFileOnWindows.md
Last active October 7, 2019 17:04
Create an empty file on Windows

Occasionally, vim on the Raspberry Pi will throw multiple Sorry, the command is not available... errors when using the basic vimrc from amix/vimrc.

This is likely 'cos the vim-gui-common and/or vim-runtime packages are missing. Fix with:

sudo apt install vim-gui-common vim-runtime

Generate random passwords on macOS

$ brew install pwgen

# In ~/.env.sh or ~/.zshenv
function genpasswd() { pwgen -1Bs $1 | pbcopy | pbpaste }

$ source ~/.zshrc
$ genpasswd 20

RDP to a host on a private network via SSH

                                            +--- Private Linux
Client - Internet - Public Linux --- ||| ---+
                                            +--- Private Windows

Assuming Public Linux can talk directly to Private Windows:

Turn off onboard LEDs on Raspberry Pi

Add the following to /etc/rc.local. This has been verified as working on a Raspberry Pi 3 with the caveat that on power up and reboot, the LEDs are on briefly before being disabled.

for led in /sys/class/leds/*
do
  printf "Disabling LED: $led\n"
  sudo sh -c "echo 0 > $led/brightness"
 sudo sh -c "echo none > $led/trigger"

Convert Garmin FIT to GPX

# Tested in zsh
for f in *.fit; do echo ${f:t:r}; gpsbabel -i garmin_fit -f "$f" -o gpx -F "${f:t:r}.gpx"; done