#!/usr/bin/env python # coding: utf-8 # In[271]: import pathlib, hvplot.pandas, notebook; from tonyfast.poser import 位 get_ipython().run_line_magic('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@饾攺饾攺馃憗饾摉鈸団挾饾攼" # In[229]: 位['IPython.display.Image']('https://upload.wikimedia.org/wikipedia/en/thumb/b/b9/MagrittePipe.jpg/300px-MagrittePipe.jpg', width=800) # In[103]: iframe("https://en.m.wikipedia.org/wiki/The_Treachery_of_Images") # In[255]: # {{calligram}} ### {{calligram}}s express meaning through `complex` irreducible `unyt`s of `type` and form. # In[258]: # Some examples of calligrams {{iframe('https://en.m.wikipedia.org/wiki/Calligram#Gallery')}} # ## My practices in abstract calligrams. # In[259]: 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 # In[262]: ## "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. # In[263]: --- --- * # 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; # In[265]: --- --- # {{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 --- # In[267]: 位['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"} }""") # In[273]: ### There are static and dynamic media ### I'm a modern scientist ## I draw in `notebook`s # I program in `notebook`s # In[274]: # Modern `notebook`s ### multi-hypermedia 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. # In[216]: 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) # In[218]: 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)) # In[285]: iframe("https://nbviewer.jupyter.org/github/deathbeds/deathbeds.github.io/tree/master/deathbeds") # In[286]: # Coding {{calligram}}s are experiments in the composition of code and narrative. # In[289]: ## {{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. get_ipython().system('[](https://user-images.githubusercontent.com/4236275/68415770-fffb5f00-018a-11ea-8bd2-303968171b5f.png)') # In[290]: ## practice informs practice > # Write the code you want to read. > ###### The medium is the message > ##### The model is the message