... 8: scroll.js   9: animation.js   10: color.py   11: README.md   12: tmux.html   14: setup.py   16: Makefile   38: kibitaki.py   buffers
1 #!/usr/bin/env fontforge -lang=py -script | 508
2 # -*- coding: utf-8 -*- | 509 ch_pane = changes.get(p.dimensions)
3 | 510 for lc in rendered.lines:
4 import fontforge | 511 line_str = str_(lc)
5 from datetime import date | 512 cl = ch_pane.get(lc.line)
6 float | 513 if cl is None or cl != line_str:
7 fight | 514 ch_pane[lc.line] = line_str
8 # Source Code Pro . .| 515 frame[p.identifier][lc.line] = line_str
9 scpro_path = "./" | 516
10 | 517 if frame:
11 # M+ | 518 n += (time.time() - n)
12 mplus_path = "./mplus" | 519 frames.append({
13 | 520 'delay': max(0, n - last_frame),
14 # Kibitaki | 521 'lines': frame.copy(),
15 # | 522 })
16 kibitaki_path = "./Kibitaki" | 523 last_frame = n
17 | 524 time.sleep(interval)
18 # .sfd | 525 except KeyboardInterrupt:
19 sfd_path ="./Kibitaki" | 526 break
20 | 527
21 # | 528 # Close the loop
22 # Open Sans , M+ , Kibitaki | 529 if len(frames) > 2:
23 font_list = [ | 530 n = time.time()
24 ("SourceCodePro-Regular.ttf", "mplus-1mn-regular.ttf", "Regular"), | 531 frames.append({
25 ] | 532 'delay': n - last_frame,
26 | 533 })
27 def main(): | 534 frame.clear()
28 # | 535
29 ï | 536 str_data = []
30 fontforge.setPrefs('CoverageFormatsAllowed', 1) | 537
31 | 538 first, frames = frames[:50], frames[50:]
32 # | 539 str_data.append('<script type="text/tmux-data">{}</script>'
33 today = date.today() | 540 .format(''.join(utils.compress_data(json.dumps(first)))))
34 version = "Kibitaki-{0}".format(today.strftime("%Y%m%d")) | 541
35 | 542 for i in range(0, len(frames), 500):
36 for (sp, mp, weight) in font_list: | 543 str_data.append(
37 sp_path = "{0}/{1}".format(scpro_path, sp) | 544 '<script type="text/tmux-data">{}</script>'
38 mp_path = "{0}/{1}".format(mplus_path, mp) | 545 .format(''.join(utils.compress_data(json.dumps(frames[i:i+500])))))
39 ki_path = "{0}/Kibitaki-{1}.ttf".format(kibitaki_path, weight) | 546
40 sf_path = "{0}/Kibitaki-{1}".format(sfd_path, weight) | 547 return tpl.render('animation.html', panes='', css=self.render_css(),
41 generate_kibitaki(sp_path, mp_path, ki_path, sf_path, weight, version) | 548 prefix=classname, data='\n'.join(str_data),
42 | 549 fg=self.rgbhex(self.default_fg),
43 def kibitaki_sfnt_names(weight, version): | 550 bg=self.rgbhex(self.default_bg))
44 return ( | 551
45 ('English (US)', 'Copyright', | 552
46 '''\ | 553 def color_type(val):
47 Kibitaki: Copylight (c) 2014-2015, lindwurm. | 554 parts = tuple(map(int, val.split(',')))
NORMAL SPELL +0 ~0 -0 animation <py python   tmux2html utf-8   25% 27: 11 E:1 | tmux2html/main.py python   tmux2html utf-8   74% 536: 21
13 | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' \ | 1 # tmux2html
14 | column -c2 -t -s :)" | 2
15 | 3 tmux2html captures full tmux windows or individual panes then parses their
16 all: ## Build everything | 4 contents into HTML in living ![color](https://cloud.githubusercontent.com/assets/111942/14111051
17 all: $(CSS) $(HTML) $(STATIC) | 5 The output can either be still snapshots, or animated sequences.
18 @: | 6
19 | 7 With a web server that uses gzip compression, the size over the network is
20 watch: ## Grandpa's change monitoring | 8 negligible for reasonably sized windows or panes.
21 @while [ 1 ]; do \ | 9
22 $(MAKE) --no-print-directory all; \ | 10
23 sleep 0.5; \ | 11 ## Examples
24 done; \ | 12
25 true | 13 Some of these may be large in dimensions. You'll need to zoom out if you want
26 | 14 to see all panes at once. These are not raster graphics!
27 clean: ## Cleanup | 15
28 rm -f $(HTML) $(CSS) $(STATIC) | 16 - ![Color](https://cloud.githubusercontent.com/assets/111942/14111051/2aa0927e-f597-11e5-85d8-e5
29 | 17 - Single Pane `[disk: 65KB, gzip: 6KB]`: https://share.esdf.io/saRkuNriJt/single.html
30 bump: | 18 - Full Window (Big) `[disk: 134KB, gzip: 11KB]`: https://share.esdf.io/h5lGMPdcZF/full.html
31 $(eval V := $(shell echo -n "$$(grep 'version=' setup.py | sed -ne "s/.*='\(.\+\)'\,/\1/p")")) | 19 - Animated `[disk: 638KB, gzip: 262KB]`: https://share.esdf.io/3qdZm2szkN/animated.html
32 $(eval NV := $(shell echo -n "$(V)" | awk -F'.' '{print $$1"."$$2"."$$3+1}')) | 20 - Partially Animated (Big) `[disk: 192KB, gzip: 79KB]`: https://share.esdf.io/EJHQXoIQDT/partial
33 sed -i -e 's/$(V)/$(NV)/g' setup.py | 21 (Only some panes are animating)
34 git add setup.py |+ 22 - "Streaming": https://share.esdf.io/log.html
35 git commit -m "Bump" |+ 23 This displays the HTTP log for the links above.
36 git tag $(NV) | 24
37 | 25 If you decide to look at the telnet animations yourself and don't know how to
38 upload: | 26 exit, use `Ctrl-]` then type `quit`. For the Star Wars animation, press
39 python setup.py sdist upload -r pypi | 27 `Ctrl-]<enter>` to get the prompt.
40 | 28
41 $(CSS): assets/base.css | 29
42 cat $< | postcss --use autoprefixer --autoprefixer.browsers "last 4 versions" --use cssnano > $| 30 ## Rationale
43 | 31
44 $(HTML): $(CSS) assets/tmux.html | 32 This was a weekend project I made for fun and I have no particular use for it
45 $(HTML):$(TPL_PATH)/%.html:assets/js/%.js | 33 beyond annoying my friends about how bad they should feel for not using tmux.
46 mkdir -p $(@D) | 34 I also thought it would be neat to have a render of my sessions that didn't
47 cat assets/tmux.html > $@ | 35 result in an image using some crummy font on a headless server.
48 browserify -p bundle-collapser/plugin $< | uglifyjs -m -c warnings=false -o .script.js | 36
49 sed -i -e '/%CSS%/{ ' -e 'r .styles.css' -e 'd}' $@ | 37 I suppose you can use cron to capture screens and display it on your website,
50 sed -i -e '/%JS%/{ ' -e 'r .script.js' -e 'd}' $@ | 38 or use it to create terminal snippets for your blog. You could also load a
51 rm .script.js | 39 pane render in elinks within your coworker's session. The only limit is your
52 | 40 imagination, my friend. :sparkles:
53 $(STATIC): $(CSS) | 41
54 $(STATIC): assets/tmux.html | 42
55 mkdir -p $(@D) | 43 ## Requirements
56 cat $< > $@ | 44
57 sed -i -e '/%CSS%/{ ' -e 'r .styles.css' -e 'd}' $@ | 45 - tmux 1.8
58 sed -i -e '/$$data/d' $@ | 46 - Python 2.7 or 3.4 (could be wrong since it's not tested in lower versions)
59 sed -i -e '/<script>/,/<\/script>/d' $@ | 47
Makefile make   utf-8   66% 39: 38 README.md markdown   utf-8   783 words 12% 17: 42
flake8: E302 expected 2 blank lines, found 1