Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
| #!/bin/sh | |
| echo "Clean Services" | |
| echo "Clean User" | |
| dscl localhost -delete /Local/Default/Users/firebird | |
| echo "Clean Group" | |
| dscl localhost -delete /Local/Default/Groups/firebird | |
| if [ -f "/Library/StartupItems/Firebird" ]; then | |
| echo "Remove SuperServer StartupItem" | |
| rm -fr /Library/StartupItems/Firebird | |
| fi |
| LOGGING = { | |
| 'version': 1, | |
| 'disable_existing_loggers': False, | |
| 'handlers': { | |
| 'mail_admins': { | |
| 'level': 'ERROR', | |
| 'class': 'django.utils.log.AdminEmailHandler' | |
| }, | |
| 'null': { | |
| 'level':'DEBUG', |
| # -*- 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. |
| #!/bin/sh | |
| version="1.4.15" | |
| priority="10415" | |
| libevent="/usr/local/libevent/2.0.20-stable/" | |
| supervisordir="/etc/supervisord.d" | |
| # create user | |
| sudo groupadd memcached | |
| sudo useradd -r -g memcached -s /sbin/nologin -M -d /var/run/memcached memcached |
| class ValidateModelMixin(object): | |
| """Make :meth:`save` call :meth:`full_clean`. | |
| .. warning: | |
| This should be the left-most mixin/super-class of a model. | |
| Do you think Django models ``save`` method will validate all fields | |
| (i.e. call ``full_clean``) before saving or any time at all? Wrong! |
This is a quick guide on installing HTTPie for Mac OS X systems. This is also useful if you want the python package management utility pip. An installed copy of Homebrew is a prerequisite.
brew install httpieEach of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass
| #!/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| # git hook to run a command after `git pull` if a specified file was changed | |
| # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" |