Skip to content

Instantly share code, notes, and snippets.

@alanbriolat
alanbriolat / tpl-0.8.1.php
Created October 30, 2012 20:08
A simple PHP template engine
<?php
/**
* Tpl - A PHP template engine
*
* Tpl is a simple hierarchical template engine inspired by the
* {@link http://www.djangoproject.com/ Django} template engine. Since PHP is
* already a template language (of sorts), Tpl does not attempt to replace it,
* but extends it with a useful inheritance framework to simplify the writing
* of templates for both small and complex web applications.
*
@alanbriolat
alanbriolat / PKGBUILD
Created October 23, 2012 12:07
Better heroku-toolbelt PKGBUILD
# Maintainer: pisuka <tekmon@gmail.com>
# Contributor: Alan Briolat <alan.briolat@gmail.com>
pkgname=heroku-toolbelt
pkgver=2.32.14
pkgrel=2
pkgdesc="Everything you need to get started using Heroku"
arch=(any)
url="https://toolbelt.heroku.com"
license=(GPL)
groups=()
@alanbriolat
alanbriolat / PKGBUILD
Created July 27, 2012 11:21
monodevelop-git AUR package tweaks
# Maintainer: Dominic Werner <aka.vince@gmail.com>
# Contributor: Jonathan Lestrelin <zanko@daemontux.org>
# Part of this PKGBUILD was taken from the monodevelop one from:
# Contributor: Daniel Isenmann <daniel@archlinux.org>
# Contributor: Timm Preetz <timm@preetz.us>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
pkgname=monodevelop-git
_pkgname=monodevelop
pkgver=20120727
@alanbriolat
alanbriolat / compiler output
Created July 18, 2012 11:33
The many faces of function definition in Fortran 95
fortran_hell.f95:146.12:
j = foo * foo
1
Warning: Possible change of value in conversion from REAL(4) to INTEGER(4) at (1)
@alanbriolat
alanbriolat / descriptor_docstring.py
Created June 6, 2012 11:39
Descriptor not seen as class in Sphinx
class ValueFilter(object):
"""A descriptor which applies *filter* to assigned values, which are stored
at *attr*. If the value is unset it is *default*.
"""
def __init__(self, attr, filter, default=None):
self.attr = attr
self.filter = filter
self.default = default
def __get__(self, instance, owner):
@alanbriolat
alanbriolat / color_descriptor.py
Created May 30, 2012 21:34
Descriptors gone wrong
class Color(object):
def __init__(self, initial=None):
self.value = initial
def __get__(self, obj, objtype):
return self.value
def __set__(self, obj, value):
self.value = value
@alanbriolat
alanbriolat / gist:2519542
Created April 28, 2012 14:39
Remove HDMI audio so pulseaudio doesn't get confused
echo "blacklist snd_hda_intel_hdmi" >> /etc/modprobe.d/blacklist.conf
@alanbriolat
alanbriolat / etcX11Xsession.d74gnome-keyring-daemon
Created April 27, 2012 16:41
Enabling gnome-keyring-daemon in Xubuntu (12.04)
# This file is sourced by Xsession(5), not executed.
STARTGKD=
GNOME_KEYRING_DAEMON=/usr/local/bin/start-gnome-keyring-daemon.sh
#if has_option use-gnome-keyring-daemon; then
STARTGKD=yes
#fi
if [ -n "$STARTGKD" ]; then
@alanbriolat
alanbriolat / schm.py
Created March 19, 2012 11:40
file schmile
def schm(word):
return 'schm' + word.lstrip("y").lstrip("bcdfghjklmnpqrstvwxz")
if __name__ == '__main__':
import sys
print sys.argv[1], schm(sys.argv[1])
@alanbriolat
alanbriolat / foo.f90
Created February 8, 2012 00:08
gfortran matrix multiplication result size bug
program foo
real, parameter :: A(2, 3) = reshape((/ 0, 0, 0, 0, 0, 0 /), (/ 2, 3 /))
real, parameter :: B(2) = (/ 0, 0 /)
real, parameter :: C(3) = matmul(B, A)
! 1
!Error: Different shape for array assignment at (1) on dimension 1 (3 and 2)
!f951: internal compiler error: in gfc_simplify_reshape, at fortran/simplify.c:5104
! This works in some versions of gfortran: