Skip to content

Instantly share code, notes, and snippets.

Matías Herranz matiasherranz

Block or report user

Report or block matiasherranz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matiasherranz
matiasherranz / date_periods_handler.py
Created May 12, 2012
Date handling util functions
View date_periods_handler.py
"""
Some date handling util functions I coded for Python/Django.
"""
import calendar
from datetime import datetime
from decimal import Decimal
from django.utils.datastructures import SortedDict
@matiasherranz
matiasherranz / .git_completion.sh
Created Sep 24, 2013
Git completion script. To be placed in the home directory.
View .git_completion.sh
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@matiasherranz
matiasherranz / .django_bash_completion
Created Sep 24, 2013
Django commands completion script. To be placed in the home folder.
View .django_bash_completion
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
@matiasherranz
matiasherranz / .profile
Created Sep 24, 2013
GIT prompt setup file (and some more Bash tune-ups) Place this file under the home directory. Name it ".bashrc" in Linux or ".profile" in Mac OS.
View .profile
# Python projects:
alias limpiarpycs='find . -iname "*.pyc" -delete'
# Para que SVN no muera por los acentos:
export LC_CTYPE=UTF-8
# General stuff:
alias ls="ls -G"
export EDITOR=nano
@matiasherranz
matiasherranz / gist:6693100
Last active Dec 23, 2015
Colours for GIT
View gist:6693100
[user]
name = Your Full Name
email = youremail@somemail.com
[alias]
conflicts = diff --name-only --diff-filter=U
st = status -s
ci = commit
br = branch
co = checkout
View gist:6693320
[matias@MacBookPro]:~$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f():
... print 'f()'
...
>>> def g():
... print 'g()'
...
View removing_duplicates.py
# Let's create a list with duplicated elements:
ls = [1,1,1,2,2,1,5,4,3,2,1]
# And let's now remove them in just one line:
l2 = list(set(ls))
# See the result:
View gist:6832420
beep() {
$@ &amp;&amp; paplay /usr/share/sounds/gnome/default/alerts/glass.ogg || paplay /usr/share/sounds/alsa/Noise.wav
}
View gist:6832433
beep() {
$@ &amp;&amp; afplay /System/Library/Sounds/Glass.aiff || afplay /System/Library/Sounds/Blow.aiff
}
You can’t perform that action at this time.