import pathlib, hvplot.pandas, notebook; from tonyfast.poser import λ
%reload_ext tonyfast.literacy
iframe = λ.partial('IPython.display.IFrame', width='100%', height=800)
pictures = λ[pathlib.Path].methodcaller('glob', '*.jpg').drop(1)[list].sorted(key=lambda x: x.stat().st_ctime).map(str)[list]
λ['requests_cache.install_cache']('calligrams')
calligram = "C@𝔏𝔏👁𝓖ⓇⒶ𝔐"
λ['IPython.display.Image']('https://upload.wikimedia.org/wikipedia/en/thumb/b/b9/MagrittePipe.jpg/300px-MagrittePipe.jpg', width=800)
λ['IPython.display.Image']('https://upload.wikimedia.org/wikipedia/en/thumb/b/b9/MagrittePipe.jpg/300px-MagrittePipe.jpg', width=800)
iframe("https://en.m.wikipedia.org/wiki/The_Treachery_of_Images")
iframe("https://en.m.wikipedia.org/wiki/The_Treachery_of_Images")
# {{calligram}}
### {{calligram}}s express meaning through `complex` irreducible `unyt`s of `type` and form.
# Some examples of calligrams
{{iframe('https://en.m.wikipedia.org/wiki/Calligram#Gallery')}}
files = pictures('docfast')
@λ.partial('ipywidgets.interact')
def show(id=(1, len(files)-3)): λ['IPython.display.display'](*(λ.partial('IPython.display.Image', width=400)(files[id]) for id in range(id, id+3)))
###### Downloading instagram photos in python `"instaloader"` https://instaloader.github.io/basic-usage.html
# instaloader profile docfast
interactive(children=(IntSlider(value=54, description='id', max=107, min=1), Output()), _dom_classes=('widget-…
files = pictures('docfast')
@λ.partial('ipywidgets.interact')
def show(id=(1, len(files)-3)): λ['IPython.display.display'](*(λ.partial('IPython.display.Image', width=400)(files[id]) for id in range(id, id+3)))
"instaloader"
https://instaloader.github.io/basic-usage.html¶# instaloader profile docfast
## "The Treachery of Images" _does not follow the rules_
# [This is not a pipe](https://monoskop.org/images/9/99/Foucault_Michel_This_Is_Not_a_Pipe.pdf) `...`
> #### Foucault provides varying analyses of Magritte's "The Treachery of Images". One chapter is formed on the basis of calligrams.
# {{calligram}}
* # augment[ing] the alphabet.
* ## repeat[ing] something without the aid of rhetoric.
### _`for ever in 'ever':...`_
* ### trap[ping] things into a double cipher.
...
¶Foucault provides varying analyses of Magritte's "The Treachery of Images". One chapter is formed on the basis of calligrams.¶
---
---
* # The {{calligram}} is thus tautological, ...
* #### It uses the possibility of repeating the same thing in different words,
* ##### and profits from the extra richness of language that
* ## allows us to say different things with a single word.
---
* ###### ... As a sign, the letter permits us to fix words; as line, it lets us give shape to things. Thus the calligram aspires playfully to efface the oldest oppositions of our alphabetical civilization:
* #### to show and to name;
* ### to shape and to say;
* ## to reproduce and to articulate;
* # to imitate and to signify;
---
---
# {{calligram}} in practice
{{calligram}} are irredicuble `unyt`s of work `...` independent of medium.
---
### _I practice calligraphy in notebooks_
## Scientists practice~~d~~ science in lab notebooks
---
λ['graphviz.Source']("""digraph {
layout=dot
node[penwidth=0 fontsize=20]
edge[style=tapered penwidth=5]
narrative->program -> {application scripting}
subgraph cluster_ousterhout {scripting application label="ousterhout's\ndichotomy"}
subgraph cluster_narrative {narrative program label=document}
subgraph cluster_types {static dynamic label=types}
scripting->dynamic
application->static
narrative-> human -> dynamic
program -> computer -> static
subgraph cluster_literate {human computer label="language"}
}""")
### There are static and dynamic media
### I'm a modern scientist
## I draw in `notebook`s
# I program in `notebook`s
# Modern `notebook`s
### multi-<i><ins>hyper</ins></i>media literate documents
## Modern computational `notebook`s represent {{calligram}}s.
> ### 🎗🎗🎗
##### {{calligram}}s
* # augment[ing] the alphabet.
* ## repeat[ing] something without the aid of rhetoric.
* ### trap[ping] things into a double cipher.
Load a bunch of gist into a dataframe.
gists = λ(1).range().map(λ["https://api.github.com/users/tonyfast/gists?page={}".format]['requests.get'].methodcaller('json').frame())[list]['pandas.concat'](20).set_index('id')
t = [x for x in gists.columns if x.endswith('_at')]; gists[t] = gists[t].apply(λ['pandas.to_datetime']); del t
files = gists.files.apply(dict.values).apply(list).apply(pandas.Series).stack().apply(pandas.Series).join(gists)
# Annual documents count.
plot = None; years = files.set_index('created_at').groupby([λ['pandas.Grouper'](freq='Y'), 'language']).filename.count().unstack().fillna(0)
for i in reversed(years.index):
if plot is None: plot = years.loc[i].rename('count').hvplot.bar(grid=True, title=str(i.year)).opts(width=300)
else: plot = plot + years.loc[i].rename('count').hvplot.bar(grid=True, title=str(i.year)).opts(width=300)
display(files.set_index('created_at').groupby([λ['pandas.Grouper'](freq='M'), 'language']).filename.count().unstack().fillna(0).hvplot.bar(stacked=True, grid=True).opts(width=900), plot.cols(3))
display(files.set_index('created_at').groupby([λ['pandas.Grouper'](freq='M'), 'language']).filename.count().unstack().fillna(0).hvplot.bar(stacked=True, grid=True).opts(width=900), plot.cols(3))
iframe("https://nbviewer.jupyter.org/github/deathbeds/deathbeds.github.io/tree/master/deathbeds")
iframe("https://nbviewer.jupyter.org/github/deathbeds/deathbeds.github.io/tree/master/deathbeds")
# Coding {{calligram}}s are experiments in the composition of code and narrative.
## {{calligram}}s are a model for type and form
# independent of medium
> ### Programmers, data scientists, any consumer of computers express themselves through text and form.
![](https://user-images.githubusercontent.com/4236275/68415770-fffb5f00-018a-11ea-8bd2-303968171b5f.png)