# Capabilities Playground

16.02.2013, in { test }

### Latex with Katex

Given two sets $A$ and $B$ the Jacard simliarity coefficient is a commonly used indicator of the similarity the two.

$$Pr[h _{min} (A)= h _{min} (B)] = J(A,B)=\frac{|A\cap B|}{|A\cup B|}$$

### Blockquotes are written like so

The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.

Nietzsche.

They can span multiple paragraphs, if you like.

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

• this one
• that one
• the other one
• and a numbered list looks like:
1. first item
2. second item
3. third item

Note that — not considering the asterisk — the actual text content starts at 4-columns in ( 4 chars from left side).

Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., “it’s all in chapters 12–14”). Three dots … will be converted to an ellipsis. Unicode is supported. ☺

# Code and dumps

## Code

Code sets a scroll on overflow and looks like this:

  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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 # Boyer-Moore Algorithm (part of) def string_search(P, T): """ Implementation of the Boyer-Moore string search algorithm. This finds all occurrences of P in T, and incorporates numerous ways of pre-processing the pattern to determine the optimal amount to shift the string and skip comparisons. In practice it runs in O(m) (and even sublinear) time, where m is the length of T. This implementation performs a case-insensitive search on ASCII alphabetic characters, spaces not included. """ if len(P) == 0 or len(T) == 0 or len(T) < len(P): return [] matches = [] # Preprocessing R = bad_character_table(P) L = good_suffix_table(P) F = full_shift_table(P) k = len(P) - 1 # Represents alignment of end of P relative to T previous_k = -1 # Represents alignment in previous phase (Galil's rule) while k < len(T): i = len(P) - 1 # Character to compare in P h = k # Character to compare in T while i >= 0 and h > previous_k and P[i] == T[h]: # Matches starting from end of P i -= 1 h -= 1 if i == -1 or h == previous_k: # Match has been found (Galil's rule) matches.append(k - len(P) + 1) k += len(P)-F[1] if len(P) > 1 else 1 else: # No match, shift by max of bad character and good suffix rules char_shift = i - R[alphabet_index(T[h])][i] if i+1 == len(P): # Mismatch happened on first attempt suffix_shift = 1 elif L[i+1] == -1: # Matched suffix does not appear anywhere in P suffix_shift = len(P) - F[i+1] else: # Matched suffix appears in P suffix_shift = len(P) - L[i+1] shift = max(char_shift, suffix_shift) previous_k = k if shift >= i+1 else previous_k # Galil's rule k += shift return matches ... 80 a chars: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 

## Dumps

Dumps looks like this, e.g. a dump from gdb [1]:

*[dev][~/gits/contests/codeforces]$gdb -batch -ex 'file c1' -ex 'set disassembly-flavor intel' -ex 'disassemble main' Dump of assembler code for function main: 0x0000000000400755 <+0>: push rbp 0x0000000000400756 <+1>: mov rbp,rsp 0x0000000000400759 <+4>: push rbx 0x000000000040075a <+5>: sub rsp,0x18 0x000000000040075e <+9>: mov esi,0x601054 0x0000000000400763 <+14>: mov edi,0x400874 0x0000000000400768 <+19>: mov eax,0x0 0x000000000040076d <+24>: call 0x400580 <scanf@plt> 0x0000000000400772 <+29>: mov DWORD PTR [rbp-0x14],0x0 0x0000000000400779 <+36>: jmp 0x4007d3 <main+126> 0x000000000040077b <+38>: mov esi,0x601058 0x0000000000400780 <+43>: mov edi,0x400874 0x0000000000400785 <+48>: mov eax,0x0 0x000000000040078a <+53>: call 0x400580 <scanf@plt> 0x000000000040078f <+58>: mov eax,DWORD PTR [rip+0x2008c3] # 0x601058 <n> 0x0000000000400795 <+64>: mov edi,eax 0x0000000000400797 <+66>: call 0x40067d <_Z2taj> 0x000000000040079c <+71>: mov rbx,rax 0x000000000040079f <+74>: mov eax,DWORD PTR [rip+0x2008b3] # 0x601058 <n> 0x00000000004007a5 <+80>: mov edi,eax 0x00000000004007a7 <+82>: call 0x400694 <_Z1bj> 0x00000000004007ac <+87>: mov rdx,rax 0x00000000004007af <+90>: mov eax,0x0 0x00000000004007b4 <+95>: sub rax,rdx 0x00000000004007b7 <+98>: add rax,rax 0x00000000004007ba <+101>: add rax,rbx 0x00000000004007bd <+104>: mov rsi,rax 0x00000000004007c0 <+107>: mov edi,0x400877 0x00000000004007c5 <+112>: mov eax,0x0 0x00000000004007ca <+117>: call 0x400540 <printf@plt> 0x00000000004007cf <+122>: add DWORD PTR [rbp-0x14],0x1 0x00000000004007d3 <+126>: mov edx,DWORD PTR [rbp-0x14] 0x00000000004007d6 <+129>: mov eax,DWORD PTR [rip+0x200878] # 0x601054 <t> 0x00000000004007dc <+135>: cmp edx,eax 0x00000000004007de <+137>: jb 0x40077b <main+38> 0x00000000004007e0 <+139>: mov eax,0x0 0x00000000004007e5 <+144>: add rsp,0x18 0x00000000004007e9 <+148>: pop rbx 0x00000000004007ea <+149>: pop rbp 0x00000000004007eb <+150>: ret End of assembler dump.  Another example: define foobar() { print "Welcome to flavor country!"; }  Here’s a note: Note: Remember, remember, the fifth of November, The Gunpowder Treason and plot. I know of no reason why the Gunpowder Treason Should ever be forgot.$\KaTeX$also works: $$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$ Here's a "picture note" Figure 1:$S$has$3$elements ($n=3$), and is represented by a Bloom filter of length$22$($m=22$) with$3$hash functions ($k=3$). Contains($w$) returns False because$B[h_{orange}(w)]==0\$.

Here’s a link to a website, to a local doc, and to a section heading in the current doc. Here’s a footnote [2].

Tables can look like this:

I am a table of variable length
that is true
but you have revealed yourself too early
notice the light gray lines dividing content!

And images can be specified like so:

And note that you can backslash-escape any punctuation characters which you wish to be displayed literally, ex.: foo, *bar*, etc.

1. Here’s a footnote text. [return]
2. Another footnote text. [return]