
By William Jeffrey Rankin, Tue Jan 30 2024
For the past several years, I've been recording my running data in a simple spreadsheet. Previously, I'd used services like Dailymile (now long defunct) and Strava (which moved many of its features to the premium version). Wanting to do something useful with the data, I wrote a set of scripts to answer the following questions:
The data look like this:
22-Jan-24,Rest day
23-Jan-24,Run,River Road,32.38,Saucony Cohesion TR15,3,Icy!
24-Jan-24,Run,River Road,58.53,Saucony Cohesion TR15,6
25-Jan-24,Run,River Road,38.83,Saucony Cohesion TR15,4
With fields consisting of:
date, activity, route title, time, shoes, distance, notes
The scripts were written in the Rexx programming language. Initially, I was only going to prototype using that language, but I was so pleased with some of its text formatting capabilities that I stuck with it.
The script produces a report that includes basic statistics, distance profile, and notes. In the example below, a report is generated for January 2024 based upon data in data.csv. To output data for the entire year, pass - rather than a three-letter month name.
jeffr@CALLISTO: D:\Documents\wo-data $ regina .\rs.rex .\data.csv 24 Jan
----------------------------Running Statistics-----------------------------
Total entries: 31
Total runs: 22
Total time: 14.33 hours
Avg. time: 39.09 minutes
Total distance: 87 miles
Avg. distance: 3.95 miles
Avg. pace: 9.89 minutes per mile
Min. distance: 3 miles
Max. distance: 6 miles
-----------------------------Distance Profile------------------------------
<3
3 to <6 *****************19
6 to <9 **3
9 to <12
12+
-----------------------------------Notes-----------------------------------
02-Jan-24: First run of 2024!
06-Jan-24: Snow run.
19-Jan-24: Snow run.
23-Jan-24: Icy!
eq.rex outputs the number of miles on a pair of shoes:
jeffr@CALLISTO: D:\Documents\wo-data $ regina .\eq.rex .\data.csv saucony cohesion tr15
saucony cohesion tr15: 75 miles
bt.rex shows the best time for a given route (in this case, route is a combination of route title and distance):
jeffr@CALLISTO: D:\Documents\wo-data $ regina .\bt.rex .\data.csv 6 River Road
17-Oct-21, Time: 48.00, 8.00 minutes per mile
gd.rex outputs planned runned data (an empty dataset) so you aren't required to key in a new month manually. Route title, shoes, and rest day are configurable.
jeffr@CALLISTO: D:\Documents\wo-data $ regina .\gd.rex 24 Feb 29
01-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,
02-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,
03-Feb-24,Run (planned),River Road,,Saucony Cohesion TR15,
...
wo-data.zip, 18K
By William Jeffrey Rankin, Tue Dec 26 2023
I've made some enhancements to Hua, my PowerShell based static content generator, over the past few days. Formerly, all tagged-with-* files, as well as index and archive files were regenerated every time Hua was run. Now, Hua runs a comparison to determine if the files have actually changed, and replaces them accordingly. In this way, files that haven't really changed are not reuploaded to a remote server by tools that rely simply on date as change criteria (among other use cases).
By William Jeffrey Rankin, Sun Nov 19 2023
The command line to install Cygwin's Apache as a service on Windows:
cygrunsrv -I httpd -d "Cygwin HTTPD" -p /usr/sbin/httpd.exe -a '-DNO_DETACH' -s TERM -o
-p specifies the path, -a the arguments passed to Apache, -s the signal to send when the service is stopped, and -o stops the service upon system shutdown.
By William Jeffrey Rankin, Wed May 17 2023
I recently installed a Subversion server and found this article on Steve's Toolbox helpful. Everything in the article worked for me with the exception of the cygrunsrv command that installs the service itself. For reference, here's the command he documents:
cygrunsrv -install svnserve -disp "CYGWIN svnserve" -path /bin/svnserve -args "-daemon -foreground -root=/cygdrive/c/svn"
Here's the command that worked for me (adjust paths as needed):
cygrunsrv -I svnserve -d 'Cygwin SVN Service' -p /usr/bin/svnserve -a '-d --foreground -r "/srv/svn"'
If you receive permission errors during check in or other operations, make sure svnserve is running under the appropriate user and has access to the repository directory. You can check this by opening Services > Properties > Log On tab.
By William Jeffrey Rankin, Sun Nov 27 2022
A basic version of the Unix uptime command, implemented in PowerShell. Reports uptime only (not user count or load averages). Testing using PowerShell 7.3 and 5.1 on Windows 10.
jeffr@CALLISTO: D:\Documents\Uptime $ .\uptime.ps1
CALLISTO: 11/27/2022 16:22:20 up 07:12:48
jeffr@IO: C:\Users\jeffr\Documents\Uptime $ .\uptime.ps1
IO: 11/27/2022 16:24:55 up 2 days, 08:32:54
# uptime - Basic PowerShell implementation of the Unix uptime command
# $Author: jeffr $
# $Date: 2022-11-30 17:04:08 -0500 (Wed, 30 Nov 2022) $
# $Revision: 4 $
$c_time = Get-Date
$b_time = Get-CimInstance -ClassName win32_operatingsystem | Select-Object lastbootuptime
$d_time = New-TimeSpan -Start $b_time.lastbootuptime -End $c_time
$a_d_time = ($d_time.ToString()).Split(':')
# Days and hours
if ($a_d_time[0].Contains('.')) {
$a_days = $a_d_time[0].Split('.')
# Day or days?
if ($a_days[0] -eq 1) {
$d_str = 'day'
} else {
$d_str = 'days'
}
$days = "$($a_days[0]) $($d_str), "
$hours = $a_days[1]
} else {
$days = ''
$hours = $a_d_time[0]
}
# Minutes
$minutes = $a_d_time[1]
# Seconds
$a_seconds = ($a_d_time[$a_d_time.Length - 1]).Split('.')
# Output the result
Write-Host "$($env:computername): $($c_time) up $($days)$($hours):$($minutes):$($a_seconds[0])"