Tuesday, May 28, 2024

Calculating time diff between two date times in Perl

A short script for calculating difference between two date times in Perl.

See source code on GitHub: https://github.com/64board/Perl/blob/main/time_diff_time_piece.pl

The Perl Time::Piece module: https://perldoc.perl.org/Time::Piece

The excellent Calendar FAQ at http://www.tondering.dk/claus/calendar.html


Wednesday, February 7, 2024

Holidays API from https://dev.timeanddate.com/holidays/

 Sample code here: https://gist.github.com/64board/0f9485c4140f62565e02ca941417f68f

Output:

2024-01-01 New Year's Day
2024-01-15 Martin Luther King Jr. Day
2024-02-19 Presidents' Day
2024-05-27 Memorial Day
2024-06-19 Juneteenth
2024-07-04 Independence Day
2024-09-02 Labor Day
2024-10-14 Columbus Day
2024-11-11 Veterans Day
2024-11-28 Thanksgiving Day
2024-12-25 Christmas Day

 

 

Thursday, January 25, 2024

2024 Holiday Schedule

 

Date Holiday
Monday, January 01 New Year’s Day
Monday, January 15 Birthday of Martin Luther King, Jr.
Monday, February 19 * Washington’s Birthday
Monday, May 27 Memorial Day
Wednesday, June 19 Juneteenth National Independence Day
Thursday, July 04 Independence Day
Monday, September 02 Labor Day
Monday, October 14 Columbus Day
Monday, November 11 Veterans Day
Thursday, November 28 Thanksgiving Day
Wednesday, December 25 Christmas Day

*This holiday is designated as "Washington’s Birthday" in section 6103(a) of title 5 of the United States Code, which is the law that specifies holidays for Federal employees. Though other institutions such as state and local governments and private businesses may use other names, it is our policy to always refer to holidays by the names designated in the law.

Wednesday, December 13, 2023

Federal Holidays 2023

 

Date Holiday
Monday, January 02 * New Year’s Day
Monday, January 16 Birthday of Martin Luther King, Jr.
Monday, February 20 ** Washington’s Birthday
Monday, May 29 Memorial Day
Monday, June 19 Juneteenth National Independence Day
Tuesday, July 04 Independence Day
Monday, September 04 Labor Day
Monday, October 09 Columbus Day
Friday, November 10 * Veterans Day
Thursday, November 23 Thanksgiving Day
Monday, December 25 Christmas Day

*If a holiday falls on a Saturday, for most Federal employees, the preceding Friday will be treated as a holiday for pay and leave purposes. (See 5 U.S.C. 6103(b).) If a holiday falls on a Sunday, for most Federal employees, the following Monday will be treated as a holiday for pay and leave purposes. (See Section 3(a) of Executive Order 11582, February 11, 1971.) See also our Federal Holidays – "In Lieu Of" Determination Fact Sheet at https://www.opm.gov/policy-data-oversight/pay-leave/work-schedules/fact-sheets/Federal-Holidays-In-Lieu-Of-Determination.

**This holiday is designated as "Washington’s Birthday" in section 6103(a) of title 5 of the United States Code, which is the law that specifies holidays for Federal employees. Though other institutions such as state and local governments and private businesses may use other names, it is our policy to always refer to holidays by the names designated in the law.

Taken from: https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/#url=2023

 

Friday, November 25, 2022

King, Bishop and Knight against King Endgame

64board
 
 
The purpose of this post is to put together some resources about this particular endgame.

I think every chess player should learn this checkmate, it requires several techniques that are present in every day chess play like piece coordination, kings opposition, value of waiting moves, etc.

Although this checkmate is consider as a basic checkmate I think it is the trickiest one, in particular because of the 50 moves rule that will help the defender in case the attacker makes a few mistakes.

The best explanation I found about this checkmate is in the book "Fundamental Chess Endings" by Karsten Muller and Frank Lamprecht. There is an Amazon paperback version and a cheaper Kindle one.

This is a very well explained YouTube video about the KBNK checkmate https://youtu.be/oRK7XLhGz_c

The following link will allow you to practice against the lichess engine. The method they explain is called Deletang's triangles, from the name of the person that formalized it. https://lichess.org/practice/checkmates/knight--bishop-mate/ByhlXnmM/D23EYigW

Personally I prefer Phillidor's method using the Knight's W route.

At chess.com I use the following link to create a custom position and challenge people to play, that way I use the randomness that humans introduce in the game, it is amazing to see how many players don't know how to deliver checkmate, https://www.chess.com/variants/custom

When perfectioning your endgame technique I found the following link to tablebases online very useful: https://www.shredderchess.com/online/endgame-database.html

For example the following endgame requires 30 moves with perfect play:

Since August 2021 chess.com also provide the tablebase feature, see announcement: https://www.chess.com/news/view/chesscom-announces-new-tablebase-feature

(This is a work in progress)

Thursday, May 5, 2022

2022 Holiday Schedule

Date Holiday
Friday, December 31 *         New Year's Day
Monday, January 17         Birthday of Martin Luther King, Jr.
Monday, February 21 **         Washington’s Birthday
Monday, May 30         Memorial Day
Monday, June 20 *         Juneteenth National Independence Day
Monday, July 04         Independence Day
Monday, September 05         Labor Day
Monday, October 10         Columbus Day
Friday, November 11         Veterans Day
Thursday, November 24         Thanksgiving Day
Monday, December 26 *         Christmas Day

*If a holiday falls on a Saturday, for most Federal employees, the preceding Friday will be treated as a holiday for pay and leave purposes. (See 5 U.S.C. 6103(b).) If a holiday falls on a Sunday, for most Federal employees, the following Monday will be treated as a holiday for pay and leave purposes. (See Section 3(a) of Executive Order 11582, February 11, 1971.) See also our Federal Holidays – "In Lieu Of" Determination Fact Sheet at https://www.opm.gov/policy-data-oversight/pay-leave/work-schedules/fact-sheets/Federal-Holidays-In-Lieu-Of-Determination.

**This holiday is designated as "Washington’s Birthday" in section 6103(a) of title 5 of the United States Code, which is the law that specifies holidays for Federal employees. Though other institutions such as state and local governments and private businesses may use other names, it is our policy to always refer to holidays by the names designated in the law.

https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/#url=2022

Wednesday, December 29, 2021

Chess 960 posible starting positions

Examples in several programming languages
http://rosettacode.org/wiki/Generate_Chess960_starting_position

All the positions with the standard ID number
https://chess960.net/wp-content/uploads/2018/02/chess960-starting-positions.pdf

https://www.chessprogramming.org/Chess960

https://github.com/MichaelB7/Chess960-Lookup/blob/master/src/960v09.c

https://en.wikipedia.org/wiki/Fischer_Random_Chess_starting_position

Very good explanation of the rules
https://codegolf.stackexchange.com/questions/12322/chess960-position-lookup/12333#12333

B   B   Q   N   N   R K R
4 * 4 * 6 * 5 * 4 * 1     = 1920

Bishops have to be of different colors (4 black squares, 4 whites squares).

There is only 1 possible position for the King and Rooks because it has to go
between the Rooks and there are only 3 squares available at that time.

Because the Knights change color when they move they could be interchanged
without any difference then 5 * 4 should be divided by 2 then
total number of positions = 960.