Skip to content

Instantly share code, notes, and snippets.

View rbonvall's full-sized avatar

Roberto Bonvallet rbonvall

View GitHub Profile
/* Hola mundo */
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hola mundo\n");
return 0;
}
#!/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:
@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"
print "Hola world"
@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
@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 / 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 / gist:717519
Created November 27, 2010 03:01
archivo-ordenar.f95
program ordenar_archivo
implicit none
integer :: a, b, st
open (unit=10, file='a.txt', action='read')
do
read (10, *, iostat=st), a
if (st /= 0) exit
! lo que viene a continuacion es la manera que vimos para agregar un
\documentclass[10pt]{article}
\usepackage{beamerarticle}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{mathpazo}
\usepackage{courier}
@rbonvall
rbonvall / Makefile
Created October 19, 2011 20:33
Simple Makefile for LaTeX documents. You have to install rubber beforehand.
TEXFILES = $(wildcard *.tex)
PDFFILES = $(TEXFILES:.tex=.pdf)
all: pdf
pdf: $(PDFFILES)
%.pdf: %.tex
@rubber --pdf $<
clean: