Sunday Dec 23, 2007

Countdown to Chrifsmas

This is what happens when you have a Sun Ray photo frame in your kitchen and a few minutes to spare:


27 lines of wish:

#!/usr/bin/wish

message .message -textvariable countdown -width 800 -font {-family times -size 24}
pack .message
set xmas [clock scan "25 dec 2007" ]

proc hours_mins_secs { total } {
	set secs [expr $total % 60 ]
	set mins [expr ($total/60) % 60 ]
	set hours [expr ($total/3600) ]
	return "$hours hours, $mins minutes, $secs seconds."
}

proc doit {} {
	global xmas
	global countdown
	set t [expr $xmas - [clock seconds]]
	if { $t > 0 } {
		set countdown  "Time Until Chrifsmas:\\n[hours_mins_secs $t]"
	} else {
		set countdown  [clock format [clock seconds]]
	}
	after 1000 doit
}

doit
tkwait  window .message

Lots of things could be better but it keeps the kids happy.

Tuesday Aug 21, 2007

New wish and tickle.

Two symbolic links make all the difference:

: pearson FSS 86 $; ls -l /usr/bin/tclsh /usr/bin/wish
lrwxrwxrwx   1 root     root           8 Aug 21 14:19 /usr/bin/tclsh -> tclsh8.4
lrwxrwxrwx   1 root     root           7 Aug 21 14:19 /usr/bin/wish -> wish8.4
: pearson FSS 87 $; 

This came to my notice as a script have for prompting for my ssh pass phrase via ssh-add stopped working after the upgrade to build 71 as it had wish8.3 hard coded into it.


So now you can just call “wish” or “tclsh” with the default path and things will work. What is more since the tcl version is now 8.4 this is large file aware so my zfs_version tlc script, which I have upgraded to use /usr/bin/tclsh now works even if the file in question is greater than 2Gb.

About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today