As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label Python. Show all posts

Carrot, never got to plant it from store bought, but that could be I was doing it wrong. Although the carrot top that Ive been caring everyday still going lush green, but I am afraid once I plant it in soil, it soon would rot just like many that I had tried before.

It finally came to me that the reason they all rot is because they were cutting, if I plant they whole, their natural skin is still intact. So, I planted two small carrots, not baby one, just about twice or thrice of my thumb. Not sure if they would have enough energy stored in their root, maybe that doesnt matter much once they can still get from soil. I will see.

Nibbling small carrots, I only did that last year. To me, carrot was always a vegetable that had to be cooked, but not anymore. The taste and sweetness are incredible, and the crunchiness makes eating one more interesting. The thin root in the end and little top can also be eaten without no effort at all.

Another comment on my Tk/Ttk progress bar example and I finally have enough of it, a big white-on-red text should be another to tell them, well, thats Id hope. But, we ended up exchanging more than 10 comments, not bad conversations.

What else?

  • Drying a 15cm long red pepper, its nearly uniformly round lengthwise about 2cm in diameter. Not sure if its Romero pepper or Serrano pepper, but this one really has smooth skin.
  • While I was eating a wax apple (Syzygium samarangense, also known as was jambu), I saw a big seed inside, that I have never seen before, usually they would be tiny dark bits, but this seed seems mature. I am going to plant it.
  • Finally, Google Consumer Surveys Website Satisfaction is showing responses, but only one analyzed and still 0 for normal one.
  • My #1000 READYT project is about half done, need to finish the opening and ending and to work with audio.
  • Bird feeder definitely is working because there was nothing left in the bottle this afternoon.

Its sad that 2048tty got no attentions when its easily by far the best implementation I have ever played. Just one star and nothing else except 5 author self-opened issues.

https://lh3.googleusercontent.com/-P9HFlx2S6cc/Vq_OCVSL0DI/AAAAAAAAJH4/DVsAhne-2rs/s800-Ic42/2048tty.gif

With --animate0.1

You use hjkl to play.

As you can the animations above, not only the tiles get the sliding motion which Ive seen before in at2048 but also the scoring, the just-earned points floating up. High score and progress is saved, so you can quit at anytime and continue playing later.

Even its graphics is designed, not just simply put a box around a number, but an oval-shaped tile. Not like there is anything wrong about rectangular box, but you can see who puts more thought on the graphics designs.

2048tty was created by Samuel Phillips on 2014-12-27, written in Python 3 with ncurses under the GPLv3, currently git-ed56d8e (2015-01-31, post v1.0 (2015-04-30)0.

First of all this isnt meant to be accurate or very reliable, even flawed, I just want to see some numbers, because in pymuxs README, it mentions about the performance, but not actual numbers:

Tmux is written in C, which is obviously faster than Python. This is noticeable when applications generate a lot of output. Where tmux is able to give fast real-time output for, for instance find / or yes, pymux will process the output slightly slower, and in this case render the output only a few times per second to the terminal. Usually, this should not be an issue. If it is, Pypy should provide a significant speedup.

1Method

I use my own test script, termfps.sh, which is written in Bash. I thought about using find or yes as mentioned in the README, but I am too lazy to write a script for the tests, I used what I already have in hand.

Since pymux is written in Python, so I tested with two implementations, the official CPython and PyPy (RPython to C). They will all run within the environment virtualenv creates, and using pip to install pymux 0.5 and Pyte 0.4.10, and along with their dependencies.

The test script is run with reset && ./termfps.sh in urxvtc with font xft:Envy Code R:style=Regular:size=20:antialias in dwm with virtually full-screen of 1680x1050, dwm topbar is hidden, and the window size is 1669x1027 and geometry is 111x33.

Both tmux and pymux are run without configuration files.

Pymux is a terminal multiplexer and a clone of tmux, but with some improvements, such as autocompletion menu as you can see below.

https://lh3.googleusercontent.com/-ZJVBn-JMjsQ/VpGbIiK3xOI/AAAAAAAAI4o/ZEfAn_67O88/s800-Ic42/pymux.gif

Panes have titlebar, which shows process command name, window title, also information from like using copy-mode. Using fish-style command-line suggestions, it also has 24-bit color support.

Pymux was created by Jonathan Slenders in 2014, written in Python 2/3 with Pyte, docopt, prompt_toolkit, and wcwidth under the New BSD License (3-clause), currently git-9877c9e (2016-01-09, v0.5 (2016-01-05)), works on Mac OS X and Linux.

cbeams is a, screensaver? It quotes tears in rain monologue of Roy Batty from Blade Runner (1982):

Ive seen things you people wouldnt believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhäuser Gate. All those moments will be lost in time, like tearsinrain. Time to die.

And this must be it:

https://lh3.googleusercontent.com/-8VRkfy2IVcY/VpAzL__Z_MI/AAAAAAAAI3M/eexOuWCRFtY/s800-Ic42/cbeams.gif

I guess you can call this script reimagine a part of what Roy Batty has seen in his final monologue, in a fashion of terminal. Numerous explosions everywhere.

cbeams was created by Jonathan Hartley on 2015-10-04, written in Python 3 with Blessings under the New BSD License (3-clause), currently version 1.0.0rc3 (2016-01-07).

termdown is a big text timer using pyfiglet for FIGlet-like text, it can count down or be used as stopwatch.

https://lh3.googleusercontent.com/-cMjMSqx2nVg/Vo7b9iVz-rI/AAAAAAAAI1E/FLAGcUNZwoI/s800-Ic42/termdown.gif

./termdown.py 5 --title termdown --text "Time's Up!" --font computer

You can specify the time by seconds or something like 13:45 or 1h 23m 45s. Also a few keys, such as Space to pause the timer.

A set of various options, you can let screen blink when times up, render seconds in red, choose different pyfiglet font, hide seconds until last minute, show a title text and/or end text, speak the second if on Mac OS X, or not to use ASCII art text.

termdown was created by Torsten Rehn, et al. on 2014-05-26, written in Python 2/3 with pyfiglet under GPLv3, currently git-6602526 (2016-01-07, post v1.9.0 (2015-10-24))

I was wandering when I stumbled on Charsor, which generates a heatmap based on cursor positions. The same thing that I have also done two years ago, X cursor heatmap in terminal using xcinfo, but this new comer uses Tk for screen size and cursor position, and a library for heatmap.

However, none of those above is the reason of writing this post, which is the following piece of code:

import  Tkinter
from    time    import sleep
from    time    import strftime
import  heatmap
import  os

# [snip] #

# Thanks mouad
screenWidth = cursor.winfo_screenwidth()
screenHeight = cursor.winfo_screenheight()

Ive seen many Python codes, all in different styles, and I thought I have seen all, because aligning variable assignments are nothing new to me, I must have seen one or two. Or those spaces wrapping inside of parentheses like some C or PHP codes. Really, I thought I have seen all.

But, never in my life I have ever seen a code that has had the import statements all align up as if its for the commander-in-chief to inspect. Truth is, this kind of style has never occurred in my mind.

Warning

Do not click the link, then open an issue, and tell that guy to PEP 8 up his *BEEP*. It is wrong and cyber-coding-bullying.

And, I must address this, I do not object any Python coding styles as long as its consistent throughout the codes. If you are a PEP 8 firm believer, please do not go scolding this author, take a cold shower to chill. PEP 8 is not the Gods words, there is still a huge distance between God and our BDFL.

Hmm, two space and one space gaps, interesting.

pybucket is an animated bucket tool, but I feel it has the potential to be a childrens coloring tool.

https://lh3.googleusercontent.com/-sIEuBGVnvTg/VoRd2fg7V_I/AAAAAAAAIxY/cfpuW49wctI/s800-Ic42/pybucket.gif

You know the coloring books, right? You feed the image and a bit of change of this tools UI, like a color swatch at bottom or on the side, so you can click to choose the color you want, and then you click to paint a section.

It doesnt have to be for children, adults would be nice, too, but I do want a terminal version, 256 colors dont provide much, but it would be fun to see it happening.

pybucket was created by Duncan Burggraf, written in Python with Pygame under the MIT License, currently git-a8d2ad1 (2015-11-09).

flycombat is part of Pygamii examples. You are an airplane and you shoot down enemys planes.

https://lh3.googleusercontent.com/-UNClOqsQXtI/Vn86NMagFMI/AAAAAAAAIwc/Pdp8DeClRYU/s800-Ic42/flycombat.gif

This is a simple game as an example for the gaming development library. You get a score on top and life as well. Several different enemty planes, so its not too bad as an example for just 287 LOC.

Pygamii was created by Carlos Maniero, written in Python 3 with readchar, termcolor, and optional Pygame for sound, under the MIT License, currently version 0.1.1.2 (2015-12-23).

PseudoBusy is not for you to slacking on job, but a noninvasive, nonintensive, screen saver.

https://lh3.googleusercontent.com/-H-lAn_bvRqA/VnyR4SEhzRI/AAAAAAAAIt8/16-4npxuOek/s800-Ic42/PseudoBusy.gif

It comes with a simple packager, so you can pack all scripts into one executable, it would be easier to move a single file.

This script actually reminds me of some scripts that help you to produce busy screens, such as compilation or whatever need to be filling up the entire screen with nonsense texts.

PseudoBusy was created by Brandon Dreager on 2015-06-03, written in Python 2 under the MIT License, currently git-efe324e (2015-12-24), for Linux, Mac OS C, and Windows.

asciifire burns your terminal, but only 80x25 area. You can change color and/or update interval, or cycle through all five colors through the command-line options.

https://lh3.googleusercontent.com/-CX-hTeVSsnM/VnnFeSP9KCI/AAAAAAAAItM/S9_zEDWASNk/s800-Ic42/asciifire.gif

python asciifire.py -t 1 -d 200000

Itd be a nice screensaver if it can fill entire terminal size, but it doesnt, unfortunately. I attempted, but I failed, but now as I staring at the GIF above, I seem to see the pattern of how it was coded. I can see the fire is shifting to the left with slight changes to each column of fire.

asciifire was created by Matt Hersant on 2013-06-25, written in Python 2 with ncurses under the GPL (version unspecified), currently git-1740a49 (2015-12-11).

arkanoid.py from PyGamii is a clone of Arkanoid or Breakout. PyGamii is an engine for ASCII games, which only has less LOC at this moment.

https://lh3.googleusercontent.com/-JrApqghUAlk/Vnh5j0OmNTI/AAAAAAAAIro/4AjCScOBYbc/s800-Ic42/pygamii-arkanoid.gif

Although its named arkanoid.py, I dont see any power-ups falling down. Since its just an example, I shouldnt expect much from it, it doesnt have a score.

The library is small, but it uses PyGame for audio, and that probably is the reason why PyGamii named PyGamii. Its not officially supports Python 2, but I found it has no problem to run with it, just its kind of glitch in display.

PyGamii was created by Carlos Maniero, written In Python 2/3 with readchar, termcolor, and optional Pygame for audio under the MIT License, currently git-2fe2332 (2015-12-15).

https://lh3.googleusercontent.com/-ZFb11smk47Y/VndtA9etOVI/AAAAAAAAIqc/MMwBtotlxyY/s800-Ic42/pythrees.gif

pythrees is the clone of Threes!, which is 1+2=3, 3+3=6, 6+6=12, and so on. If you have played 2048 game, you can find the similarity, both 4x4 grid, and merging with same numbered tiles, except the first merge of Threes!

The visual design is fairly simple, only a few colors and plain ASCII, but it does tell you what the next tile will be sliding in. It doesnt keep high scores.

pythrees was created by Yuan Cao on 2015-03-01, written in Python 2 with ncurses under the MIT License, currently git-e3209a5 (2015-12-10).

Terminal_Worm is yet another clone of Snake or Nibbles. The only thing different probably is the time-limited bugs, which adds significant bonus point, but you have to eat it before it disappears.

https://lh3.googleusercontent.com/-U2YYpsvPG0I/VnIWkmdviiI/AAAAAAAAIos/gG3A4sk0NBM/s800-Ic42/Terminal_Worm.gif

Video for longer playing

Its title screen is nice, a snake wiggling its tail. The screen is wrapped, that is you can go through edge and come out from the other side.

Terminal_Worm was created on 2013-02-10 by Martijn Pieters, written in Python 3 with ncurses under the GPLv3, currently git-81babbc (2015-12-16, post v1.0 (2014-07-19)).

boom (GitHub) is

A 2-player battle game made for Ludum Dare 28 (December 2013), for the theme you only get one.
https://lh3.googleusercontent.com/-yA_yyT1OeKU/VmirxGUdJEI/AAAAAAAAImY/2PfIFmLdyLw/s800-Ic42/boom.gif

The game goes like this, two players, each has many fake mine and one possibly real mine, but you never know if you get the real real mine until the detonation of the possibly real mine.

It can be played with keyboard or Xbox 360 controllers and it has sound.

You lay as many mines as you like, and hope your opponent will come close near the possibly real mine and you detonate the mines. If its real, you win. If its not, you can still play cool since your opponent has not yet deploy the real mine and still doesnt know that is a real deal. If your opponent detonates the real mine and doesnt blow you up, then you are the winner.

Its a fun game.

boom was created on 2013-12-13 by Joseph Lansdowne, written in Python 2/3 and C with Pygame under the GPLv3, currently git-a0fb8ac (2014-01-18).

Unintentional Christmas Tree is a fun and small arcade action puzzle game. You just lay the same color blocks on top of each other.

https://lh3.googleusercontent.com/-c0LR-X__54w/VmEBiYhUysI/AAAAAAAAIkk/7k6s-tpLwks/s800-Ic42/christmas.raw.gif

It has two modes, easy and hard. In hard mode, you cant make any mistakes, e.g. red on green, or that would be game over. In easy mode, lets just say that you can break this tree really easily.

Unintentional Christmas Tree was created by Joseph Lansdowne on 2012-02-27, written in Python 2 with Pygame under New BSD License (3-clause), currently git-da562ee (2012-02-27).

The question is not red or green but left or right.

This post is made for people who need to quickly pick a style of Pygments Styles. I wrote a script just to generate the list of code blocks each with different style, using itself as example code to highlight.

Note

This was first created on YJL -wiki with Pygments 1.5 at 2012/06/02 09:20:24-09:43:08.

page background color to .

Pygments version: 2.0.1

1   autumn

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

2   borland

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

3   bw

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

4   colorful

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

5   default

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

6   emacs

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

7   friendly

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

8   fruity

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

9   igor

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

10   manni

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

11   monokai

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

12   murphy

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

13   native

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

14   paraiso-dark

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

15   paraiso-light

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

16   pastie

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

17   perldoc

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

18   rrt

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

19   tango

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

20   trac

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

21   vim

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

22   vs

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()

23   xcode

 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
import sys

import pygments
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer
from pygments.styles import get_all_styles

style_block = <style>\n%s\n</style>

with open(sys.argv[0]) as f:
  # skip the heading comments
  code = f.read().split(\n\n, 1)[1]

print(Pygments version: %s % pygments.__version__)
print()

indent = lambda s:    + s.replace(\n, \n  )
for style in sorted(get_all_styles()):
  class_tag = pygments-%s % style
  print(%s % style)
  print(%s % (= * len(style)))
  print()
  formatter = HtmlFormatter(linenos=True, cssclass=class_tag, style=style)
  print(.. raw:: html\n)
  print(indent(style_block % formatter.get_style_defs(. + class_tag)))
  print(indent(highlight(code, PythonLexer(), formatter)))
  print()