Skip to content

Instantly share code, notes, and snippets.

@ralsina
ralsina / gyro-0.2.md
Last active July 13, 2017 20:10
Gyro 0.2

Gyro grows some legs

It was just a couple of days ago that I started an experimental wiki project called Gyro ... it's always fun when a project just grows features organically. It does this, so it makes sense to make it do that, and then this other thing is easy, and so on.

So, here is what happened with Gyro:

  • Federico Cingolani made it run on docker
  • I added some features:
    • UI for creating new pages
    • UI for deleting pages
@ralsina
ralsina / rst2sile.py
Created June 28, 2017 01:57
This is something that could grow into a replacement for rst2pdf using http://sile-typesetter.org
Or so one can hope.
@ralsina
ralsina / nikola-design.rst
Created April 27, 2017 11:20
Initial design document for Nikola

How This Thing Should Work

  • There are pages, templates, and data.
  • data + template = page
  • The list of pages may not be known before running (exmaple, list of a blog's tags), so it may need to be built from the database.
@ralsina
ralsina / pensar con los dedos.md
Last active April 27, 2017 13:30
Pensar Con Los Dedos
@ralsina
ralsina / love-jsonschema.md
Last active July 12, 2020 04:05
How I learned to stop worrying and love JSON Schema
@ralsina
ralsina / pyparsing tutorial draft.md
Last active September 5, 2018 11:23
Creating DSLs for Dummies

Intro

I don't have the usual programmer's education. I studied maths, and then dropped out of that, and am mostly self-taught. So, there are some parts of programming I always saw wearily, thinking to myself that I really should go to school to learn them. One remarkable such area is parsing and implementing languages.

Well... sure, school is always a good idea, but this is not that hard. In this article I will explain how to go from nothing to a functioning, extensible language, using Python and PyParsing. If you are as scared of grammars, parsers and all that jazz as I used to be, come along, it's pretty simple,

Grammar (part I)

What is a grammar? It's what defines what is and what is not valid in our language, and it's the hardest part to get right, mostly because it's all about making decisions.

# Usando esta lista de palabras:
# https://raw.githubusercontent.com/javierarce/palabras/master/listado-general.txt
import sys
validos = set('abcdefol')
colores = set()
for palabra in open(sys.argv[1]):
palabra = palabra.strip()
@ralsina
ralsina / diario.md
Last active October 28, 2016 12:13
Diario de viaje marzo-abril 2016

Sábado 12 de marzo

Nos levantamos temprano para viajar a Puerto Iguazú en un vuelo de LAN, saliendo de Aeroparque a las 9 AM. Como somos cuidadosos, pensábamos llegar a las 7. Para eso me levanté 5:30. ¡Soy cuidadoso! Por eso revisé el mail de Despegar buscando el código de reserva. Como soy cuidadoso, lo puse en la página de LAN, que amablemente me informó que mi reserva no existía.

Oops.

Resulta que mi pago a Despegar habia sido rechazado, y el mail que avisaba eso fué a la carpeta de spam. Y era ANTERIOR al mail que decía "Felicitaciones por su reserva". En fin. Voy donde estaba Rosario y le digo: "No me mates, pero ... no tenemos pasajes." Sorprendido de seguir vivo, bajé y traté de comprarlos de nuevo. Como aparte de cuidadoso soy medio salame, lo intenté por Despegar. Luego de ser rechazado 4 veces más, fuí a la página de LAN y, sorpresa! Compré exactamente los mismos pasajes que había comprado un mes antes, a casi el mismo precio, con la misma tarjeta que Despegar rechazaba. FUCK

@ralsina
ralsina / ttt.py
Created March 2, 2016 19:28
Tic-Tac-Toe with the computer player
import copy
board = {
'A': [' ', ' ', ' '],
'B': [' ', ' ', ' '],
'C': [' ', ' ', ' '],
}
def print_board():
@ralsina
ralsina / book2.tmpl
Last active September 12, 2015 17:36
book template with better typesetting
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%inherit file="post.tmpl"/>
<%block name="extra_head">
${parent.extra_head()}
<script src="/assets/js/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/Flowtype.js/1.1.0/flowtype.min.js"></script>