Skip to content

Instantly share code, notes, and snippets.

View rbonvall's full-sized avatar

Roberto Bonvallet rbonvall

View GitHub Profile
@rbonvall
rbonvall / extra_texescape.py
Created October 29, 2010 00:20
Sphinx extension for mapping unicode symbols to their LaTeX equivalents
# encoding: utf-8
import sphinx.util.texescape as te
replacements = ur'''
✓ OK
✗ XX
⁰ \ensuremath{^{0}}
¹ \ensuremath{^{1}}
² \ensuremath{^{2}}
³ \ensuremath{^{3}}
@rbonvall
rbonvall / diapo.tex
Created August 24, 2010 18:56
Highlight one line of a listing at a time in LaTeX
\documentclass[12pt]{beamer}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{palatino}
\usefonttheme{serif}
\lstloadlanguages{fortran}
@rbonvall
rbonvall / rut.py
Created July 5, 2010 23:56
Dígito verificador del RUT en Python
# encoding=utf-8
# Obtener el dígito verificador del RUT en Python.
#
# La función recibe el RUT como un entero,
# y entrega el dígito verificador como un entero.
# Si el resultado es 10, el RUT es "raya k".
from itertools import cycle
print "Hola world"
@rbonvall
rbonvall / git-prompt.sh
Created February 23, 2009 17:39 — forked from henrik/.bashrc
Git prompt
#!/bin/bash
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
DIRTYCHAR="●"
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "$DIRTYCHAR"
#!/usr/bin/env python3.0
import sys, array, tempfile, heapq
assert array.array('i').itemsize == 4
def intsfromfile(f):
while True:
a = array.array('i')
a.fromstring(f.read(4000))
if not a:
/* Hola mundo */
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hola mundo\n");
return 0;
}