This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import Image | |
def resize_and_crop(img_path, modified_path, size, crop_type='top'): | |
""" | |
Resize and crop an image to fit the specified size. | |
args: | |
img_path: path for the image to resize. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
.input_error { | |
color: red; | |
font-weight: bold; | |
} | |
#code_value_error { | |
color: red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export LANGUAGE==en_US.utf8 | |
export JAVA_HOME=/usr/lib/jvm/java-8-oracle | |
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash | |
source ~/.utils/git-completion.bash | |
# Only if docker installed | |
source /etc/bash_completion.d/docker | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# post-checkout hook (on <path-to-project>/.git/hooks/post-checkout file) | |
# to avoid errors for old pyc files when checkout. | |
# Remember execution privileges (chmod +x <path-to-project>/.git/hooks/post-checkout). | |
#!/bin/bash | |
# Start from the repository root | |
cd ./$(git rev-parse --show-cdup) | |
# Delete pyc and empty directories | |
echo "[post-checkout] Deleting .pyc and empty directories" | |
find . -name "*.pyc" -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import TestCase | |
import inspect | |
class AssertExample(object): | |
def __create_method(self, tc, name): | |
def method(self, *args, **kwargs): | |
return tc.__getattribute__(name)(self, *args, **kwargs) | |
return method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import re | |
import subprocess | |
from functools import partial | |
# Fabric requirement just for easy colour output | |
from fabric.colors import red, green, yellow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Your Name | |
email = [email protected] | |
[color] | |
ui = true | |
[pull] | |
default = current | |
[push] | |
default = current | |
[alias] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
import glob | |
from lxml import etree | |
def tests_elements(nodes): | |
for elm in nodes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
service postgresql stop | |
TMPDIR=/tmp/tmp_psql | |
MOUNTPOINT=/var/lib/postgresql | |
mount -t tmpfs -o size=512M,nr_inodes=10k,mode=0777 tmpfs $TMPDIR | |
rsync --archive $MOUNTPOINT/ $TMPDIR/ | |
mount -o bind $TMPDIR $MOUNTPOINT | |
service postgresql start |
OlderNewer