# Ta Te Ti

Es­to es un ta-te-ti (con ju­gador hu­mano y/o pro­gra­mado!) que hice en al­gún mo­men­to de 2016.

import copy

board = {
'A': [' ', ' ', ' '],
'B': [' ', ' ', ' '],
'C': [' ', ' ', ' '],
}

def print_board():
for i in "ABC":
print(" | {} | {} | {} |".format(*board[i]))

def check_winner_state(board, mark):

for i in "ABC":
if board[i] == [mark, mark, mark]:
return True

for j in [0,1,2]:
if [board["A"][j], board["B"][j], board["C"][j]]  == [mark, mark, mark]:
return True

if [board["A"][0],board["B"][1],board["C"][2]] == [mark, mark, mark]:
return True
if [board["A"][2],board["B"][1],board["C"][0]] == [mark, mark, mark]:
return True
return False

players_marks = "XO"

print_board()

player_names = {}

for mark in players_marks:
whatever = input("Enter your name for %s" % mark)
player_names[mark] = whatever

def human_player(mark):
return input("Enter turn {}: ".format(mark)).upper()

def computer_player(mark):
# Try everything and see if you can win
other_mark = set(players_marks) - set(mark)
for i in 'ABC':
for j in 0,1,2:
_b = copy.deepcopy(board)
if _b[i][j] != ' ':
continue
_b[i][j] = mark
if check_winner_state(_b, mark):
return i+str(j+1)

# So, we can't win. Try not to lose
for i in 'ABC':
for j in 0,1,2:
_b = copy.deepcopy(board)
if _b[i][j] != ' ':
continue
_b[i][j] = other_mark
if check_winner_state(_b, other_mark):
return i+str(j+1)

# fuck it
for i in 'ABC':
for j in 0,1,2:
if board[i][j] == ' ':
return i+str(j+1)

players = [computer_player, computer_player]

selector = 0
while True:

turn = selector % 2

mark = players_marks[turn]
inp = players[turn](mark)
if len(inp) != 2:   # A1
continue

x, y = inp
if x not in "ABC" or y not in "123":
continue
y = int(y)-1

if board[x][y] != ' ':
print("Position taken: ", inp)
continue

# mark the input
board[x][y] = mark

print_board()

if check_winner_state(board, mark):
print("%s, you are the winner, congrats!" % player_names[mark])

break

if selector == 8:
print("No more goes, no one wins, sorry :(")
break

selector += 1

# Ten Perversions

This is some­thing I wrote in 2007 for a site that is al­ready dead.

I read once that the way to make crazy mon­ey in the in­ter­nets to post lists and write non-­fic­tion about sex.

Here's my at­tempt at bring­ing eight new per­ver­sions to this tired world.

Grou­cho Marx would have hat­ed it, but nowa­days there is al­ways a club that will ac­cept you if you are will­ing to ac­cept that you want to join.

Do you en­joy watch­ing ap­par­ent­ly gay mino­taurs? Have a per­ver­sion about peo­ple with ex­tra mem­ber­s? Head for http://www.boy­tau­r.net (and no, I will not ex­plain how I knew about that site).

Are you aroused by the thought of step­ping on bugs? Be­lieve you are an an­i­mal trapped in a hu­man body? The idea of alien mind con­trol turns you on? En­joy dil­dos made out of legos? There are places where you will not be con­sid­ered a weirdo (but you are. Oh, yes you are).

1. Lo­­gosphil­i­a: Sex­u­al arouse­­ment caused by knowl­­edge. This word ac­­tu­al­­ly ex­ist­s, at least as the ti­­tle of a blog. I would ex­­plain more, but lo­­gosphil­i­acs know all about it, and for the rest of us it's an in­­­cred­i­bly bor­ing con­di­­tion.

2. Taediphil­i­a: The taediphil­i­ac en­joys bore­­dom. How­ev­er, this per­ver­­sion is just sad. Imag­ine that bore­­dom gives you wood. Wood en­ter­­tains you. En­ter­­tain­­ment kills the wood. And your life is a spin cy­­cle of un­­ful­­fil­l­­men­t.

3. Or­­tophil­i­a: Be­ing ex­c­it­ed by what's right. This rare con­di­­tion caus­es all kinds of strange sym­p­­tom­s. The suf­fer­­er prefers the mis­­­sion­ary po­si­­tion, dis­­­dains oral sex, on­­ly feels sex­u­al at­­trac­­tion to his spouse and ac­­tu­al­­ly means it when he says he would be hap­py to just cud­­­dle.

4. Uni­­for­­mophil­i­a: Ex­ces­­sive love for things that are reg­u­lar. The rare uni­­for­­mophil­i­ac would love to have sex with twin­s, but he's too busy trim­ming his side­burns just right.

5. Ni­hilophil­i­a: Sex­u­al per­ver­­sion where you are at­­trac­t­ed to the con­­cept of noth­ing. Ob­vi­ous­­ly mas­­tur­ba­­to­ry at the be­gin­n­ing, the sub­­­ject soon re­al­izes that when he is en­joy­ing him­­self he is ac­­tu­al­­ly there, which kills the buz­z. On a lat­er stage, the ni­hiliphil­i­ac pre­­tends that he is ex­c­it­ed but hid­ing it, when in re­al­i­­ty he ac­­tu­al­­ly is not. Er­­go, since noone is hav­ing fun, he finds that ex­treme­­ly ex­c­it­ing.

6. Pho­bio­phil­i­a: Ex­ces­­sive en­joy­­ment of one's fears. Noone con­fess­es to this per­ver­­sion, since ad­mit­t­ing it in pub­­lic would be scary, which would cause arousal, which would be em­bar­ras­ing, un­­less the sub­­­ject is al­­so scared of au­di­ences, which would make him en­joy the at­ten­­tion. It ba­si­­cal­­ly means that you would act com­­plete­­ly against your own in­­­cli­­na­­tion­s. All moun­­tain climbers are acro­pho­bic pho­bio­phil­i­ac­s.

7. Phil­io­phil­i­a: Sex­u­al per­ver­­sion where you try one per­ver­­sion af­ter an­oth­er in vain search of one you ac­­tu­al­­ly en­joy. If that de­scribes you, you are not an ac­­tu­al per­vert. You are a bor­ing per­­son and just try to look in­­ter­est­ing in a self­­-de­struc­­tive and noisy man­n­er.

8. Al­bu­mis­­tanu­merophil­ia is the love of lists of num­ber­s. And if you have it, you will hate the fact that this ar­ti­­cle ends here.

# Siege Perilous (Foreworld, #5)

### Review:

And so it end­s. The Mon­go­li­ad, then re­named "Fore­world Saga" which start­ed with such prom­ise ends with a whim­per, in a stretched-out al­most plot­less nub­bin of a book, and then clos­es the sto­ry with a piff like the flac­cid fart of an old nun.

# Mi Escritorio

Hace un­os días puse en twit­ter una fo­to de mi es­crito­rio y me sor­prendió el in­terés que gen­eró, ya que pen­sé que no tenía na­da de es­pe­cial sal­vo que lo había limpia­do :-)

Co­mo al pare­cer ter­minó sien­do in­tere­san­te, acá va con al­gu­nas ex­pli­ca­ciones.

Este es mi es­crito­rio ac­tu­al, que tiene una mejo­ra con re­spec­to al orig­i­nal, porque el tecla­do es mejor:

La idea es que un es­crito­rio "limpi­o" me ayu­da a con­cen­trarme (en gen­er­al fun­ciona). Lo úni­co que hay es:

• Tecla­do Log­itech TK820
• Note­book ASUS Ux305f
• Mon­i­tor Sam­sung 1080p 27"
• Una birome (la parte de atras sirve para pan­tallas touch)
• Una car­pe­ta ne­gra
• Un jar­ro tér­mi­co de café de Py­ConAr 2017

y no se ven, pero ten­go a mano un­os au­ric­u­lares que a ve­ces quedan en el es­crito­ri­o.

Ca­da una de esas cosas tiene un porqué, y si agre­gara una cosa más ... la bar­rera para en­trar es bas­tante al­ta.

En este mo­men­to ten­go un Log­itech TK820 que tiene un touch­pad grande (11x11cm) al costa­do. Es un tecla­do "chi­cle" es­ti­lo note­book, pero las teclas tienen más trav­el (casi 1.5m­m) y el touch­pad es muy bueno. En gen­er­al pre­fiero touch­pad en vez de mouse por las muñe­cas, y al es­tar al costa­do no lo to­co mien­tras es­cri­bo, lo que es un plus.

Me gus­ta que sea wire­less porque mantiene el es­crito­rio li­bre de ca­bles, y al ser RF no tiene lag co­mo pasa con al­gunos BT viejos.

Lo com­pré en ofer­ta en un vi­a­je en ... 2014? Es un mod­e­lo de 2013, sigue an­dan­do per­fec­to! No lo es­ta­ba us­an­do por uno de los de­fec­tos de este teclado: no tiene donde guardar el don­gle de RF. Por suerte es un "u­ni­fy­ing re­ceiver" de Log­itech y se con­siguen re­puestos.

Ten­go en­car­ga­do y vi­a­jan­do des­de Laos un tecla­do mecáni­co que ver­e­mos si lo reem­plaza, va a ten­er que hac­er una au­di­ción.

### Jarro de PyConAr

To­mo mu­cho café. Al ser un jar­ro tér­mi­co me ayu­da a tomar­lo más lento porque no se en­fría tan­to. Aparte es de Py­ConAr que es la mejor con­fer­en­cia del mun­do mundi­al :-)

### Carpeta negra

Hay pa­pe­les que ten­go que ten­er a mano. No quiero ten­er pa­pe­les en el es­crito­ri­o. Me busqué la car­pe­ta más pare­ci­da posi­ble a mi note­book y la puse del otro la­do del mon­i­tor para dar simetría.

La birome es para in­ter­facear con los pa­pe­les.

### Monitor

Cortesía de Thirstie mi ac­tu­al em­pleador/­cliente que tenía un­os mon­i­tores al cuete en un cowork­ing :-)

Has­ta hace poco tra­ba­ja­ba ex­clu­si­va­mente con la pan­talla de la note­book (es 13.3" 1080p) pero ... lamentable­mente mis ojos ya no son lo que er­an y se me es­ta­ba cansan­do la vis­ta, así que sim­ple­mente cam­bié a un mon­i­tor con la mis­ma res­olu­ción pero el cuá­dru­ple de su­per­fi­cie (27") y que tiene al­gunos ex­tras co­mo "eye saver" que te limi­ta la luz azul (no sé si sirve para al­go pero lo uso) y real­mente se ve muy bi­en.

Tal vez en un fu­turo pase a un mon­i­tor 2k del mis­mo tamaño. Un mon­i­tor 4k es real­mente un des­perdi­cio, si ya casi no veo los pix­e­les del 1080p :)

Un up­grade planea­do es pon­er un mejor pie o un bra­zo para per­mi­tir ajus­tar en al­tura o ro­tar la pan­talla a "por­trait" que es mejor para codear (ex­traño to­davía mi note­book con pan­talla 4:3, en­tra­ba TAN­TO códi­go...)

Tiene dos fines:

• Me gus­ta con­tro­lar­lo por voz
• Fun­ciona co­mo par­lante blue­tooth!

Si bi­en el au­dio no es WOW sue­na sor­pren­den­te­mente bi­en para ser así de chiq­ui­to.

### Auriculares

Son un­os Blue­dio Tur­bine T4S que com­pré en ofer­ta el año pasa­do (y con el dolar a \$20!). Lo que me gus­ta de es­tos au­ric­u­lares es:

• Blue­tooth con so­porte de dos dis­pos­i­tivos, así que fun­cio­nan con mi celu­lar y mi note­book al mis­mo tiem­po.
• Son over-ear así que aún con la can­celación de rui­dos apa­ga­da para ahor­rar batería aís­lan bas­tante.
• A mí me quedan có­mo­d­os (hay gente a la que no)
• La batería du­ra fá­cil tres o cu­a­tro días y car­ga al toque. Pe­or de los ca­sos si no los puedo car­gar en el mo­men­to hay un ca­ble de au­dio.
• Son de met­al, se sien­ten pre­mi­um por así de­cir. Los uso hace un año mu­cho y re­cién aho­ra em­piezan a ten­er al­gunos prob­le­mas muy menores (no "tra­ba" uno de los la­dos, ni se no­ta)
• El au­dio es bueno.

### Escritorio

Es un es­crito­rio he­cho a me­di­da por Var­il­las lo que tal vez suene lu­joso pero no lo es, sale más bara­to que el equiv­a­lente he­cho de aglom­er­a­do en Easy.

Mide casi dos met­ros de largo, para dar dos puestos de tra­ba­jo (el mío y el de Rosar­i­o) con tres es­tantes en el medio lo que da lu­gar de al­ma­ce­namien­to dis­cre­to con unas ca­jas lin­das y lu­gar para ca­blea­d­o.

Las patas son de var­il­la cuadra­da de acero pin­ta­do de ne­gro, la tapa de madera sól­i­da de paraí­so. Es bási­ca­mente in­de­struc­tible a menos que lo de­je en una la­gu­na.

En gen­er­al ten­go pocos ca­bles por ele­gir ac­ce­so­rios in­alám­bri­cos. La note­book y el mon­i­tor tienen ca­bles de al­i­mentación, y hay un ca­ble HD­MI en­tre am­bos. Los or­gan­icé con un aparati­to a tal efec­to de go­ma y pe­sa­do para que los ca­bles no se mue­van:

El Google Home tam­bién tiene un ca­ble, pero va di­rec­to ha­cia aba­jo y no se ve.

Hay una parte que to­davía no he aco­modado, que es el ba­jo es­crito­ri­o:

En al­gún mo­men­to jun­taré ganas y us­aré al­go co­mo es­to para or­ga­ni­zar­lo.

Fuera de es­o, tal vez un hub usb para no ten­er que ten­er don­gles y cosas así en la note­book mis­ma.

### Notebook

Una Asus Zen­book UX305F que com­pré por menos de 700 dólares hace co­mo 4 años así que es­tá suma­mente amor­ti­za­da.

La CPU es una In­tel Core M-5Y10c du­al core, 4 threads con 8GB de RAM y video lo que sea que viene con es­to (In­tel HD5300?) que es ... de­ci­di­da­mente mediocre!

Sin em­bar­go, sin­ce­r­a­mente no re­cuer­do en los primeros tres años de ten­er­la haber di­cho "esto es una car­reta". Hoy en día ... sí, cuan­do levan­to un sis­tema dock­er­iza­do con una can­ti­dad de con­tain­ers ... po­dría ser más ráp­i­da.

Así que es­toy vien­do de pasar a al­go co­mo una Asus Zen­book UX33­FA que tiene 16GB de RAM, un SSD el doble de grande, una CPU mu­cho más ráp­i­da (es de­masi­a­do y hace que la note­book sea muy cara pero no en­cuen­tro CPUs mediocres con 16GB de RAM...)

Sí, ese mod­e­lo es muy caro así que pien­so es­per­ar un poco y com­prar­lo re­fur­bished a menos pla­ta (a­ho­ra es­tá a 890 "co­mo nue­va")

Qué es lo bueno de mi note­book ac­tu­al:

• La batería aún 4 años de­spués to­davía aguan­ta 4 ho­ras. Aguanta­ba 7 cuan­do la com­pré. Pen­san­do en ren­o­var­la, el reem­pla­zo es sen­cil­lo y el re­puesto sale 50 dólares.
• La pan­talla es her­mosa aún hoy.
• El tecla­do y el touch­pad son ra­zon­ables.
• El pe­so. Pe­sa 1.2kg y el car­gador 300g. Ni se siente en la mochi­la.

### Software

Hace un tiem­po que es­toy us­an­do Namib Lin­ux que lo podés pen­sar co­mo "Arch para seres hu­manos". O sea, es Arch, pero con un in­sta­l­ador lin­do y desk­top por de­fault (podés ele­gir cual querés).

Mi desk­top por aho­ra es KDE 5.15 que me sor­prendió por lo puli­do. Voy proban­do cosas, Deepin y MATE son muy in­tere­santes.

### Cosas que no hay en el escritorio

#### Libreta

Para no ten­er una li­bre­ta en el es­crito­rio to­mo no­tas en Qown­Notes que es un bal­ance muy co­pa­do en­tre po­ten­cia y sen­cillez.

#### Teléfono

To­das las apli­ca­ciones de men­sajería del celu­lar es­tán en Ram­box con temas os­curos y no lla­man la aten­ción.

Para aten­der lla­madas uso los au­ric­u­lares. Para saber que sue­na el telé­fono (y otras no­ti­fi­ca­ciones) uso KDE­Con­nect que hace cosas co­mo mutear la músi­ca cuan­do sue­na una lla­ma­da y en gen­er­al no nece­site nun­ca mi­rar el celu­lar.

Al­gunos ya los men­cioné, pero los que ten­go en mi cabeza son:

• Tecla­do mecáni­co y mouse "lin­do"
• Bra­zo para mon­i­tor / so­porte reg­u­la­ble
• Note­book más nue­va
• Cac­tus?

# Coffee As a Service Architecture

## Coffee As A Service Architecture

### Intro

To­day I was in a meet­ing with re­cruiters (yes, re­al­ly) be­cause they want to be bet­ter at tech­ni­cal re­cruit­ing and they had the idea that talk­ing to me would help them (o­h, sweet sum­mer chil­dren).

A nice time was had by all (I hope) and at one point I was asked about what ar­chi­tec­ture was, and more specif­i­cal­ly, about the dif­fer­ence be­tween mi­croser­vices and a mono­lith.

Which I tried to ex­plain us­ing what I had at hand: cof­fee cup­s, sug­ar dis­penser­s, a spoon and so on. It did­n't quite work out but I kept think­ing about it on my way home and ... let's try again.

### What is Architecture?

Ar­chi­tec­ture, when it comes to soft­ware, can be de­fined in many ways, but one way I like is to say that ar­chi­tec­ture in­volves:

• What the com­po­nents of your sys­tem are
• How they are done
• How they talk to each oth­er

There is a lot more, but you start with that, and that is more or less enough to ex­plain mono­liths and mi­croser­vices.

### The Coffee Service

One thing of mas­sive im­por­tance about sys­tems is that they are meant to do some­thing. They ex­ist for a pur­pose. So, let's sup­pose the pur­pose of our sys­tem is to make cof­fee and put it in a cup.

We can call the cup the "cof­fee clien­t" and what­ev­er we use to make the cof­fee is the "cof­fee sys­tem" or "cof­fee ser­vice"

So, as­sum­ing you have a can full of cofee beans and a cup, how do you make cof­fee?

## The Coffee Monolith

This is my very own cof­fee ma­chine. Not on­ly is it mono­lith-shaped, it's func­tion­al­ly mono­lith­ic (it's al­so large enough to de­serve its own table, as you can see).

It has two buck­ets on top. On one you put wa­ter, in the oth­er you put cof­fee bean­s. Then, you put a cup un­der the spig­ot and press a but­ton or two.

It will:

• Grind the beans
• Put the ground cof­fee in the right place and ap­ply the "right" pres­sure
• Heat the wa­ter to the "right" tem­per­a­ture
• Run wa­ter through the cof­fee grounds
• Pour the cof­fee in­to the cup
• Dis­card the grounds in­to a hid­den de­posit

Sounds awe­some, right? It is!

It takes all of 30 sec­onds to go from cof­fee beans to a nice cup of cof­fee! It tastes good!

And it's im­por­tant to keep that in mind. IT IS GREAT.

Mono­lith­s, when they done cor­rect­ly and you are not ex­pect­ing any­thing out of their op­er­at­ing pa­ram­e­ter­s, are awe­some.

The prob­lem with mono­liths is not that they can't be done right, it's that it's hard to do them right, and that even when you do get it right, in our in­dus­try the mean­ing of "right" is not fixed.

So, be­cause the whole point is to ride this anal­o­gy in­to the ground, let's con­sid­er all the things about this awe­some ma­chine.

### Flexibility

It grounds the cof­fee. What hap­pens if you want it ground fin­er? Or coarser?

It turns out that if you have the right tool you can ad­just the mil­l's out­put (it's not in the man­u­al).

In a mi­croser­vice-based cof­fe­mak­er I would re­place the grinder.

It has three set­tings. Want any­thing else? No luck.

In a mi­croser­vice-based cof­fee ser­vice I would just use an ad­justable ket­tle.

How about the amount of cof­fee per cup?

It has three set­tings. Want any­thing else? No luck.

In mi­croser­vice-­cofee I would just trans­mit as much cof­fee as I want­ed.

How about chang­ing the bean va­ri­ety be­tween cup­s?

The bean hop­per takes half a pound of bean­s. It's not easy to get them out. So, no.

In mi­croser­vice-­cof­fee heav­en I could have mul­ti­ple hop­pers pro­vid­ing beans of all va­ri­eties and just con­nect to the one I want to­day!

Cup size?

It does two sizes (but you re­pro­gram those sizes)

In mi­croser­vice-­cofee I would just pour as much wa­ter as I liked.

A mono­lith has the flex­i­bil­i­ty its de­sign­ers thought of adding, no more, no less. And chang­ing it is ... not triv­ial.

I could use a vac­u­um clean­er to re­move the beans from the hop­per and change va­ri­eties. I would con­sid­er that a hack. I have al­so done it. I re­gret noth­ing.

### Unused Features

It has a thing that lets you set­up a cred­it sys­tem for cof­fee cups I will nev­er use. A milk foamer I use once a week. Why? Be­cause "we may need this and it's hard to add it lat­er, so let's just do it from the be­gin­ning" ground cof­fee.

Some­times yes, it's use­ful (ca­puc­ci­no!) but some­times it's just some­thing I paid for and will nev­er use (cof­fee cred­it­s!)

In a mi­croser­vice ar­chi­tec­ture I would just get a new milk foamer, use both for a while and then keep us­ing the one I like.

### Hard to Improve

How do I add a bet­ter foam­ing thingie?

By buy­ing one and putting it in the ta­ble.

How do I add a more flex­i­ble cof­fee grinder?

I can't be­cause this ma­chine is in­com­pat­i­ble with pre-­ground cof­fee. There is a new­er, more ex­pen­sive mod­el that can take that but this one? You need to throw it away.

Mod­i­fy­ing a mono­lith­ic sys­tem is dif­fi­cult be­cause the pieces are tight­ly cou­pled. I can't use a sep­a­rate grinder be­cause the sys­tem re­quires the cof­fee grounds to ar­rive via a spe­cif­ic in­ter­nal duct at a spe­cif­ic point in the cof­fee-­mak­ing cy­cle, there is just no way to in­sert my grind-o-­mat­ic-3000 in there with­out a saw and duct tape.

In a mod­u­lar sys­tem I would un­plug the grinder and in­sert a com­pat­i­ble-but-d­if­fer­ent grinder, in a mi­croser­vice ar­chi­tec­ture I would just use what­ev­er grinder and put the cof­fee grounds in a mes­sage and have the next piece in the sys­tem pick it from there.

### Expensive

This cof­fee ma­chine is ex­pen­sive. It's much more ex­pen­sive than buy­ing a grinder, a cof­fee ma­chine a ket­tle and a milk foamer.

What it pro­vides in ex­change for the ex­tra mon­ey (and re­duced flex­i­bil­i­ty and so on) is per­for­mance. I don't boil wa­ter, I don't grind cof­fee, I don't pour, I just press a damned but­ton and en­joy cof­fee.

### Outsourcing

You can buy pre-­ground cof­fee and ef­fec­tive­ly out­source that part of the process to some ex­ter­nal provider.

I can't! I am doomed to ground my own cof­fee for­ev­er.

### Maintenance

I have a lu­bri­ca­tion sched­ule, or else my ex­pen­sive ma­chine will break.

I have to dis­in­fect the cof­fee ground bin or else it will have mag­got­s.

I have to emp­ty the wa­ter waste tray be­fore it over­flows.

I have to have a thing to dump the bits of dirty wa­ter it us­es to clean it­self when it turns on/of­f.

I have to buy spe­cial acid to pe­ri­od­i­cal­ly re­move scale from its in­nards or it will stop work­ing. That costs ac­tu­al mon­ey and takes half an hour.

I need to cleanup cof­fee crud from all the in­ter­nal springs, levers and thin­gies ev­ery cou­ple of week­s.

Now, you, read­ers with nor­mal cof­fee mak­ing things? How is your cof­fee ma­chine main­te­nance rou­tine? What, you don't have one? Thought so.

### Conclusion

So, that's why nowa­days most peo­ple pre­fer to pay the per­for­mance penal­ty of a mi­croser­vice ar­chi­tec­ture in­stead of us­ing an awe­some mono­lith.

This is not ex­haus­tive, there is still sep­a­ra­tion of con­cern­s, en­cap­su­la­tion, rigid­i­ty of con­tracts and a lot more, but it should be con­vinc­ing enough with­out be­ing dog­mat­ic :-)