diff --git a/images/ALAN.jpg b/images/ALAN.jpg new file mode 100644 index 0000000..eaadba7 Binary files /dev/null and b/images/ALAN.jpg differ diff --git a/images/pigeon.gif b/images/pigeon.gif new file mode 100644 index 0000000..e11c1fa Binary files /dev/null and b/images/pigeon.gif differ diff --git a/mdwntohtml b/mdwntohtml index 71069bb..81a57cc 100755 --- a/mdwntohtml +++ b/mdwntohtml @@ -8,9 +8,8 @@ while IFS=: read field value; do Title) # echo strips leading and trailing whitespace title=$(echo $value) - break ;; esac done -cat | markdown | m4 -DTITLE="$title" $1 - +markdown | m4 -DTITLE="$title" $1 - diff --git a/papers/Jamfile b/papers/Jamfile index d97aa7f..005f46b 100644 --- a/papers/Jamfile +++ b/papers/Jamfile @@ -1,3 +1,3 @@ SubDir TOP papers ; -Webify index.mdwn reply-to-still-harmful.mdwn sockets.mdwn DNS.mdwn html-tutorial.mdwn digimatrix.mdwn ; +Webify index.mdwn reply-to-still-harmful.mdwn sockets.mdwn DNS.mdwn html-tutorial.mdwn digimatrix.mdwn tank-tread.mdwn ; diff --git a/papers/index.mdwn b/papers/index.mdwn index 3c5814a..4272b86 100644 --- a/papers/index.mdwn +++ b/papers/index.mdwn @@ -4,6 +4,7 @@ These are papers I have written. Most of them were written to explain a concept to someone on woozle. Hopefully other people will find them useful, too. +* ["Tank Tread" key-signing protocol](tank-tread.html) * [Reply-To Munging Still Considered Harmful](reply-to-still-harmful.html) * [Introduction to TCP Sockets](sockets.html) * [3-Minute HTML Tutorial](html-tutorial.html) diff --git a/projects/gitweb.css b/projects/gitweb.css index 2c88835..e9408c8 100644 --- a/projects/gitweb.css +++ b/projects/gitweb.css @@ -1,5 +1,5 @@ -#body { - max-width: 100%; +body { + max-width: inherit; } span.cntrl { @@ -71,7 +71,7 @@ div.title, a.title { } a.title:hover { - background-color: #d9d8d1; + background-color: #fff; } div.title_text { @@ -184,19 +184,19 @@ th { } tr.light:hover { - background-color: #edece6; + background-color: #fff; } tr.dark { - background-color: #f6f6f0; + background-color: #c6c6c0; } tr.dark2 { - background-color: #f6f6f0; + background-color: #c6c6c0; } tr.dark:hover { - background-color: #edece6; + background-color: #fff; } td { diff --git a/tartans/loom.py b/tartans/loom.py index 7e2cb61..a0fb001 100755 --- a/tartans/loom.py +++ b/tartans/loom.py @@ -114,25 +114,42 @@ def ascii_test(): ## Tartan junk ## -colors = {'R': Yarn(0.50, 0.00, 0.00), # Red - 'G': Yarn(0.00, 0.30, 0.00), # Green - 'B': Yarn(0.00, 0.00, 0.50), # Blue - 'C': Yarn(0.00, 0.25, 0.25), # Cyan - 'Y': Yarn(0.80, 0.80, 0.00), # Yellow - 'P': Yarn(0.60, 0.00, 0.60), # Purple (?!) - 'W': Yarn(0.60, 0.60, 0.60), # White - 'K': Yarn(0.00, 0.00, 0.00), # Black - 'BK': Yarn(0.00, 0.00, 0.00), # Black - 'GR': Yarn(0.25, 0.25, 0.25), # Gray - 'DB': Yarn(0.00, 0.00, 0.30), # Dark Blue - 'LB': Yarn(0.00, 0.25, 0.60), # Light Blue - 'LR': Yarn(0.60, 0.00, 0.00), # Light Red - 'LG': Yarn(0.00, 0.60, 0.00), # Light Green - 'LV': Yarn(0.50, 0.25, 0.60), # Lavender - 'BR': Yarn(0.30, 0.25, 0.00), # Brown - 'LGR': Yarn(0.60, 0.60, 0.60), # Light Gray - 'LBR': Yarn(0.40, 0.40, 0.00), # Light Brown - } +# +# Colors according to http://www.tartanregister.gov.uk/guidance.aspx +# +colors = [('A', '\x00\x44\x99'), # Azure (light blue) + ('B', '\x00\x00\x44'), # Blue + ('C', '\xdc\x14\x3c'), # Crimson + ('G', '\x00\x44\x00'), # Green + ('K', '\x00\x00\x00'), # Black + ('Mn', '\x80\x00\x00'), # Maroon + ('N', '\x44\x44\x44'), # Neutral (gray) + ('P', '\x99\x00\x99'), # Purple + ('R', '\x99\x00\x00'), # Red (scarlet) + ('T', '\x66\x66\x00'), # Tan (brown) + ('W', '\x99\x99\x99'), # White + ('Y', '\x99\x99\x00'), # Yellow + ] +if True: + colors = {'R': Yarn(0.50, 0.00, 0.00), # Red + 'G': Yarn(0.00, 0.30, 0.00), # Green + 'B': Yarn(0.00, 0.00, 0.50), # Blue + 'C': Yarn(0.00, 0.25, 0.25), # Cyan + 'Y': Yarn(0.80, 0.80, 0.00), # Yellow + 'P': Yarn(0.60, 0.00, 0.60), # Purple (?!) + 'W': Yarn(0.60, 0.60, 0.60), # White + 'K': Yarn(0.00, 0.00, 0.00), # Black + 'BK': Yarn(0.00, 0.00, 0.00), # Black + 'GR': Yarn(0.25, 0.25, 0.25), # Gray + 'DB': Yarn(0.00, 0.00, 0.30), # Dark Blue + 'LB': Yarn(0.00, 0.25, 0.60), # Light Blue + 'LR': Yarn(0.60, 0.00, 0.00), # Light Red + 'LG': Yarn(0.00, 0.60, 0.00), # Light Green + 'LV': Yarn(0.50, 0.25, 0.60), # Lavender + 'BR': Yarn(0.30, 0.25, 0.00), # Brown + 'LGR': Yarn(0.60, 0.60, 0.60), # Light Gray + 'LBR': Yarn(0.40, 0.40, 0.00), # Light Brown + } sett_re = re.compile('([A-Za-z]{1,3}|\([A-Fa-f0-9]{3}\))(\d{1,3})') diff --git a/tartans/tartan.py b/tartans/tartan.py deleted file mode 100755 index d3bbf64..0000000 --- a/tartans/tartan.py +++ /dev/null @@ -1,117 +0,0 @@ -#! /usr/bin/python - -import sys -import Image -import re -import array - -colors = {'R': '\x88\x00\x00', # Red - 'G': '\x00\x44\x00', # Green - 'B': '\x00\x00\x44', # Blue - 'C': '\x00\x44\x44', # Cyan - 'Y': '\x99\x99\x00', # Yellow - 'P': '\x99\x00\x99', # Purple (?!) - 'W': '\x99\x99\x99', # White - 'K': '\x00\x00\x00', # Black - 'BK': '\x00\x00\x00', # Black - 'GR': '\x44\x44\x44', # Gray - 'DB': '\x00\x00\x55', # Dark Blue - 'LB': '\x00\x44\x99', # Light Blue - 'LR': '\x99\x00\x00', # Light Red - 'LG': '\x00\x99\x00', # Light Green - 'LV': '\x88\x44\x99', # Lavender - 'BR': '\x55\x44\x00', # Brown - 'LGR': '\x99\x99\x99', # Light Gray - 'LBR': '\x66\x66\x00', # Light Brown - } -sett_re = re.compile('([A-Za-z]{1,3}|\([A-Fa-f0-9]{3}\))(\d{1,3})') - -def str_to_sett(s): - """Convert an xtartan sett string into a sett tuple.""" - - sett = [] - while s: - m = sett_re.search(s) - if not m: - break - cs = m.group(1) - if cs[0] == '(' and cs[-1] == ')': - ca = array.array('B') - for a in cs[1:-1]: - ca.append(int(a+a, 16)) - c = ca.tostring() - else: - c = colors[cs] - n = int(m.group(2)) - sett.append((c, n)) - s = s[m.end():] - if not s.endswith('.'): - o = sett[:] - o.reverse() - sett += o - return sett - - - -class Loom: - """Simulates a simple loom with only one weft color per row. - - This probably does a simplistic weave too, I don't know enough about - weaving to say for sure. But I can imagine more complicated ways of - doing it. - - """ - - def __init__(self, warp): - self.warp = warp - self.cloth = [] - self.row = 0 - - def weave(self, weft): - out = [] - for i in range(len(self.warp)): - if (i + self.row) % 2 == 0: - out.append(weft) - else: - out.append(self.warp[i]) - - self.cloth.append(out) - self.row += 1 - - -class Tartan: - def __init__(self, sett): - # Weave a whole pattern suitable for tiling. In other words, it - # does the mirroring for you. - - if type(sett) == type(''): - sett = str_to_sett(sett) - - warp = [] - for c,n in sett: - warp += [c]*n - - if False: - # Offset it to the center of the first dealie - o = sett[0][1] / 2 - warp += warp[:o] - del warp[:o] - - self.loom = Loom(warp) - for w in warp: - self.loom.weave(w) - - rgbs = [''.join(x) for x in self.loom.cloth] - imgstr = ''.join(rgbs) - self.img = Image.fromstring('RGB', - (len(self.loom.cloth[1]), - len(self.loom.cloth)), - imgstr) - - def png(self, fd): - self.img.save(fd, 'PNG') - -if __name__ == '__main__': - sett = sys.argv[1] - t = Tartan(sett) - t.png(sys.stdout) diff --git a/tartans/tartantomdwn b/tartans/tartantomdwn index 129134a..19f13b8 100755 --- a/tartans/tartantomdwn +++ b/tartans/tartantomdwn @@ -1,22 +1,19 @@ #! /bin/sh -header () { - while IFS=: read key val; do - tval=$(echo $val | sed "s/'/\'/g") - case $key in - Name) - echo -n "TARTAN='$tval';" - ;; - Sett) - echo -n "SETT='$tval'" - ;; - "") - break - ;; - esac - done -} +while IFS=: read key val; do + tval=$(echo $val | sed "s/'/\'/g") + case $key in + Name) + tartan="$tval" + ;; + Sett) + sett="$tval" + ;; + "") + break + ;; + esac +done -eval $(header) -m4 -DTARTAN="$TARTAN" -DSETT="$SETT" -DIMAGE="$1" $2 - +m4 -DTARTAN="$tartan" -DSETT="$sett" -DIMAGE="$1" $2 -