Skip to content

Instantly share code, notes, and snippets.

View azhtom's full-sized avatar
🏠
Working from home

Daniel Soria azhtom

🏠
Working from home
View GitHub Profile
@azhtom
azhtom / gist:8588647
Last active January 4, 2016 07:29
Git Pretty Log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# git lg:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@azhtom
azhtom / ImageField Size Validation
Created January 4, 2014 21:21
ImageField Size Validation
class Meta:
model = NameModel
def clean_image(self):
image = self.cleaned_data.get['image']
if image:
from django.core.files.images import get_image_dimensions
w, h = get_image_dimensions(image)
if not image.content_type in settings.VALID_IMAGE_FORMATS:
raise forms.ValidationError(u'Only *.gif, *.jpg and *.png images are allowed.')
@azhtom
azhtom / Linux Tips
Created November 10, 2013 23:52
Tips para linux, la lista se actualiza en cada momento.
# Limpiar el path
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games