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 / get_extension.py
Created Sep 26, 2014
Get filename extension function, using a regex.
View get_extension.py
import re
def get_extension(filename):
regex = re.compile(r'^.*?[.](?P<ext>tar\.gz|tar\.bz2|\w+)$')
return regex.match(filename).group('ext')
@matiasherranz
matiasherranz / get_extension2
Created Sep 26, 2014
Get filename extension function, using a regex. Keep the point.
View get_extension2
import re
def get_extension(filename):
regex = re.compile(r'^.*?.(?P<ext>.tar\.gz|.tar\.bz2|.\w+)$')
return regex.match(filename).group('ext')
@matiasherranz
matiasherranz / gist:9a4f2a2cb2d03aced6a4
Created Sep 26, 2014
Get filename extension function, using a regex. Keep the point.
View gist:9a4f2a2cb2d03aced6a4
import re
def get_extension(filename):
regex = re.compile(r'^.*?.(?P<ext>.tar\.gz|.tar\.bz2|.\w+)$')
return regex.match(filename).group('ext')
@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
View nagios.cfg
santex@santex-VirtualBox:~/DevIT/nagios_samanage$ cat nagios.cfg
# 'notify-host-by-sam' command definition
define command{
command_name notify-host-by-sam
command_line <perl path> <script path>/sam_createcase --hostname=$HOSTNAME$ --type="$NOTIFICATIONTYPE$" --state=$HOSTSTATE$ --address=$HOSTADDRESS$ --output="$HOSTOUTPUT$" --date="$LONGDATETIME$"
}
# 'notify-service-by-sam' command definition
define command{
command_name notify-service-by-sam
View playing with js.js
function Car() {
}
Car.protoype = {
}
@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
You can’t perform that action at this time.