Blog

Article Tags

Installing svnserve on Cygwin

By WJR, 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"'

Additional Notes

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.

    Article Tags

    Windows Uptime Using Powershell

    By WJR, Sun Nov 27 2022

    About

    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.

    Usage & Sample Output

    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
    

    The Code

    # 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])"
    

        Article Tags

        Old Farmer's Almanac Sun/Planetary Rise and Set Times

        By WJR, Sat Nov 12 2022

        A set of scripts written in the Rexx programming language that produce localized sun/planetary rise/set times based upon data in The Old Farmer's Almanac. These have been replaced by the Astronomical Almanac scripts, but are still occasionally useful.

        Included are supporting libraries (CORTIME.rex and TIMEADJS.rex) and sample data files. The DAY.txt file contains time adjustments for locality and should be replaced with appropriate values for your location (refer to the Time Corrections section in the almanac).

        The scripts have been tested on Cygwin, Linux, Windows 10, and FreeDOS.

        Example Usage

        srss.rex: Takes a file containing uncorrected sunrise and set values from the Old Farmer's Almanac and a file containing time corrections for locality. Pass 'today' as third argument to show results for current day only. Outputs corrected values.

        jeffr@Ganymede: ~/rise-set-times $ regina srss.rex srss-data.txt DAY.txt | tail -n 5
        11/26/2022, 7:32 AM, 5:16 PM
        11/27/2022, 7:33 AM, 5:15 PM
        11/28/2022, 7:34 AM, 5:15 PM
        11/29/2022, 7:36 AM, 5:14 PM
        11/30/2022, 7:37 AM, 5:14 PM
        

        planets.rex: Takes a file containing uncorrected planet rise and set values and a file containing time corrections for locality. Outputs corrected values.

        jeffr@Ganymede: ~/rise-set-times $ regina planets.rex planet-data-2022.txt DAY.txt | tail -n 5
        10/11/2022, Saturn, Set, 2:48 AM
        10/21/2022, Venus, Set, 6:52 PM
        10/21/2022, Mars, Rise, 9:45 PM
        10/21/2022, Jupiter, Set, 5:41 AM
        10/21/2022, Saturn, Set, 2:08 AM
        

        rscli.rex: A simple command line interface to the CORTIME library. Takes an uncorrected time, AM/PM, a file containing time corrections for locality, and correction column. Outputs corrected time.

        jeffr@Ganymede: ~/rise-set-times $ regina rscli.rex 6:32 AM DAY.txt e
        7:16 AM
        

        lod.rex: Takes the output of srss.rex and calculates day lengths.

        jeffr@Ganymede: ~/rise-set-times $ regina srss.rex srss-data.txt DAY.txt \ | tail -n 5 | regina lod.rex
        12/27/2022, 9:06
        12/28/2022, 9:06
        12/29/2022, 9:07
        12/30/2022, 9:08
        12/31/2022, 9:08
        

        Download

        rise-set-times.tar.gz, 7K

        Related Articles

            Article Tags

            Integrating Hua's Markdown Support

            By WJR, Thu Nov 10 2022

            Hua, my PowerShell based static content generator, now supports Markdown. I wanted to integrate and test it on an actual blog. This page is coded in Markdown.

            Integration with my existing blog was simple. All that was required was to modify the md-template.html file in Hua's markdown directory to contain the appropriate HTML structures, and voila!

            Related Articles

                Article Tags

                Planetary Rise and Set Times Using aa

                By WJR, Thu June 23 2022

                A set of scripts (bash and awk) used to produce localized planet rise and set times based upon output from aa (Stephen L. Moshier's astronomical almanac program). Output formats include the raw output from aa, CSV, HTML, tabular, and postscript.

                Usage

                planet-rs.sh takes a standard aa input file (refer to my post on aa for an example) and, optionally, format (raw, csv, html, or ps), time zone and a time zone label. In the example outputs below, rise and set times are displayed for Jupiter in July, 2022, EDT (-4 hours from UT).

                Raw Output

                jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt raw -4 EDT | head
                Input file: Jupiter-07-2022.txt
                rises 2022 July 1 Friday 1h 20m 19.873s EDT
                sets 2022 July 1 Friday 13h 36m 25.567s EDT
                rises 2022 July 2 Saturday 1h 16m 37.113s EDT
                sets 2022 July 2 Saturday 13h 32m 54.005s EDT
                rises 2022 July 3 Sunday 1h 12m 53.963s EDT
                sets 2022 July 3 Sunday 13h 29m 21.585s EDT
                rises 2022 July 4 Monday 1h 09m 10.417s EDT
                sets 2022 July 4 Monday 13h 25m 48.300s EDT
                rises 2022 July 5 Tuesday 1h 05m 26.473s EDT

                CSV Output

                jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt csv -4 EDT | head
                Input file: Jupiter-07-2022.txt
                07/01/2022, 01:20 EDT, 13:36 EDT
                07/02/2022, 01:16 EDT, 13:32 EDT
                07/03/2022, 01:12 EDT, 13:29 EDT
                07/04/2022, 01:09 EDT, 13:25 EDT
                07/05/2022, 01:05 EDT, 13:22 EDT
                07/06/2022, 01:01 EDT, 13:18 EDT
                07/07/2022, 00:57 EDT, 13:15 EDT
                07/08/2022, 00:54 EDT, 13:11 EDT
                07/09/2022, 00:50 EDT, 13:07 EDT

                Tabular Output

                jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt table -4 EDT | head
                Input file: Jupiter-07-2022.txt
                +-----------+------------+------------+
                |   Date    |    Rise    |    Set     |
                +-----------+------------+------------+
                |07/01/2022 |  01:20 EDT |  13:36 EDT |
                +-----------+------------+------------+
                |07/02/2022 |  01:16 EDT |  13:32 EDT |
                +-----------+------------+------------+
                |07/03/2022 |  01:12 EDT |  13:29 EDT |
                +-----------+------------+------------+

                HTML and Postscript

                Here's an example of the HTML output. The example postscript output was converted to PDF using ps2pdf.

                Day Length Calculations

                The lod.awk script takes CSV output and calculates day lengths.

                jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Sun-12-2022.txt csv -5 EST | head | awk -f lod.awk
                Date, Length of Day
                12/01/2022, 9:33
                12/02/2022, 9:31
                12/03/2022, 9:30
                12/04/2022, 9:29
                12/05/2022, 9:28
                12/06/2022, 9:28
                12/07/2022, 9:27
                12/08/2022, 9:26
                12/09/2022, 9:25

                Download

                The package below includes a sample aa.ini (edit to reflect desired latitude, longitude, etc.) as well as input files for various planets. The scripts have been tested on Ubuntu Linux and Cygwin.

                planet-rs.tar.gz, 2.9K

                Known Issues

                If you get an error message similar to the following when attempting to use the ps output format:

                troff: fatal error: can't find macro file s

                It may be due to a missing Groff macro. I solved this issue on Ubuntu Linux by installing the complete Groff package (in addition to the base package, which is installed be default).

                Related Articles

                    Article Tags

                    aa - Astronomical Almanac - Compiled for Cygwin

                    By WJR, Thu June 16 2022

                    Stephen L. Moshier's venerable aa program (an astronomical almanac used to calculate planet and star positions), compiled for Cygwin (gcc version 11.3.0). It can be used interactively, or input can be directed from a text file.

                    aa - Astronomical Almanac, version 5.6 (aa-5.6.tar.gz, 161K)

                    Example Usage

                    Used interactively, simply ./aa. Or with input directed from a file, ./aa < Mars-2022-06.txt. Sample input file Mars-2022-06.txt to display data for Mars in June, 2022. The second set of numbers, ending with -1, tells aa to quit.

                    Configuration

                    Longitude, latitude, altitude, and other local parameters are specified in the aa.ini file. Note: this file must reside in the same directory as the aa executable.

                    -84.17 ;Terrestrial east longitude of observer, degrees
                    39.95  ;Geodetic latitude, degrees
                    252.0  ;Height above sea level, meters
                    10.0   ;Atmospheric temperature, deg C
                    1000.0 ;Atmospheric pressure, millibars
                    1      ; 0 - TDT=UT, 1 - input=TDT, 2 - input=UT
                    0.0    ;Use this deltaT (sec) if nonzero, else compute it.

                    Further Reading

                    Refer to the read.me file included with the distribution.

                    Related Articles