Version 4 of Twigging

Updated 2008-11-15 13:37:04 by Stu

A page for discussing Twig

Stu 2008-11-14 Numbers and checksums on this page current as of this writing.


Preemptive Q&A:

Q: Isn't it dangerous to run code from strange places?<<br>>
A: The danger can be averted by checking the code then calculating
a checksum and verifying the code against the checksum before running it.
Hence, Twig.

Q: Ok, there's this page of 'twigs'.
What if someone alters the code then alters the checksum in that big bundle of twigs?
A: There is a checksum against the entire block (or 'bundle', if you prefer).

Q: What if someone alters that as well?
A: I keep the twig of that block on my site as well; you can check against that.

Q: Can I trust you?
A: I'd like to think so.

Q: I don't know ...
A: You can save the twig(s)/check the code yourself.

Twig

Get Twig from Twig or my site. If you're too lazy to copy & paste then wget and a bit of awk can do it. General use instructions on the Twig page.

How to use the twigs on the Twigs page (if you're not using TkTwig).
These examples assume that Twig is installed in your path as 'twig'.

# run #111
$ twig 21912 4 | awk 'NR==111 {print}' | twig -c - | wish &

# verify twigs, then run #111
$ twig 21912 2 | twig -c - | awk 'NR==111 {print}' | twig -c - | wish &

TkTwig

Get TkTwig from TkTwig or my site. Use it or Twig to get the twigs on the Twigs page or get them some other way. Find some new ones and share!

If you're really lazy, this will pull both TkTwig and the Tcler's Wiki twigs, combine and run.

(twig 21912 2 | twig -c - | awk 'NR==310 {print}' | twig -c -; echo 'set ::cow {'; twig 21912 2 | twig -c -; echo '};tktwig::loadBundle +::cow') | wish &

Or this:

(twig 21912 2 | twig -c - | awk 'NR==310 {print}' | twig -c -; twig 21912 2 | twig -c -) | wish -b - &

Mashups

Interesting results can be achieved by combining pages.

This combines the Starfield and Spirograph pages. I've found that Starfield can be mixed with many others.

(twig 21912 2 | twig -c - | awk 'NR==279 {print}' | twig -c -;twig 21912 2 | twig -c - | awk 'NR==276 {print}' | twig -c -) | wish &

These examples are long because they include the checking of the big twig bundle as well as each twig being used. The above could also be done as follows, without any checking. Be careful!

(twig 10100 1; twig 4206 2) | wish & 

TwigSrc

Augment source with Twig

# twigsrc.tcl
namespace eval twig {
	variable sourceMap; array set sourceMap {}
	rename ::source ::_source; interp alias {} ::source {} [namespace current]::src
	proc src {fn args} { variable sourceMap
		if {[info exists sourceMap($fn)]} { uplevel 1 [exec twig -c - <<$sourceMap($fn)]
		} else { uplevel 1 _source $fn {*}$args }
	}
	proc addSrc {fn twig} { variable sourceMap; set sourceMap($fn) $twig }
}
###

Twig for card_img (14629)

# card_img.tcl twigsrc
twig::addSrc card_img.tcl {14629 1 C1C8795ED7BD3C21E742DE426FCE0AB2}
#

Twig for Spider Solitaire (11317)

# Spider Solitaire (11317) twig
21913 7 3914C06435A7BC93038CD737BCA61B35
21913 8 0E5F39CB7C5DC6CC6619A8F2A3828A16
11317 1 F267A7044616795D85B4D9EF7A4177DA

enter categories here