Project: Sudoku Solver in NASM

This project is a working copy.

Updates

2015-06-12
Read input board from STDIN
Print formatted input board

2015-06-19
Added function to check if a cell value has any duplicate within the same row
Fixed comments containing instructions to compile and run
Added comments

2015-06-27
Added function to check if a cell value has any duplicate within the same column
Fixed comments containing instructions to compile and run

2015-07-10
Added function to check if a cell value has any duplicate within the same miniboard

2015-07-24
Added function to check if a cell value is valid (no duplicate value within same row, column or miniboard)
Added function to get next highest valid value for a cell

2015-07-31
Implemented main search and backtrack solver logic
Added and modified comments
Fixed bug with func_check_value_row function
Added line break after printing board in func_print_board function

[gist https://gist.github.com/sharpbang-root/8f45fafcf50921d65195 /]
Advertisements

Automatic Time Synchronisation for D-Link ShareCenter DNS-320

If the current date/time for the D-Link ShareCenter DNS-320 gets reset everytime the the NAS shuts down, a script can be used to perform date/time synchronisation on boot-up. (This requires Fonz fun_plug to be installed.)

Create the file /ffp/start/timesync.sh with the following content.

#!/ffp/bin/sh

# PROVIDE: timesync
# REQUIRE: inetd

. /ffp/etc/ffp.subr

name="timesync"
start_cmd="timesync_start"

timesync_start()
{
    date +%s -s @`wget -O - -q http://www.icanhaztimestamp.com/`;
}

run_rc_command "$1"

Explanations

The key to the script lies in the following line.

date +%s -s @`wget -O - -q http://www.icanhaztimestamp.com/`;

It can be broken down as follows.

www.icanhaztimestamp.com

This is a web service that returns the current UNIX timestamp in plain text. (I.e. the HTTP response body contains nothing but the ten-digit current UNIX timestamp.)

wget -O - -q http://www.icanhaztimestamp.com/

This wget command makes a request to the specified URL and outputs the HTTP response body (in this case, the ten-digit current UNIX timestamp).

date +%s -s @`wget -O - -q http://www.icanhaztimestamp.com/`

This date command sets the current date/time to the specified UNIX timestamp which, in this case, is the response from www.icanhaztimestamp.com.

This script would run once when the NAS boots up, and hence, the date/time would be synchronised.

Note: wget had to be used to obtain the current date/time because ntpd did not appear to be present.

Note: Though the DNS-320 administrator console allowed an NTP server to be configured, the NAS did not appear to synchronise the time with the server. (Perhaps because ntpd was not present.)

References:

[1] https://nas-tweaks.net/tutorials/
[2] http://www.icanhaztimestamp.com/