Instance | Branch |
---|
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
import datetime | |
import logging | |
import itertools | |
from logging import handlers | |
from django.core.management.base import BaseCommand | |
from django.contrib.sites.models import Site | |
from django.contrib.auth.models import User | |
from django.core.mail import send_mail | |
from django.conf import settings | |
from django.template import Context, Template |
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 | |
# Unload the keyboard so I can use my external keyboard | |
# and not worry about accidentally pressing buttons on | |
# the built-in. This may not be a problem for you but, you | |
# should see my desk sometimes (Oh no!!) ;-) | |
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ |
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 http://vanderwijk.info/blog/adding-css-classes-formfields-in-django-templates/#comment-1193609278 | |
from django import template | |
register = template.Library() | |
@register.filter(name='add_attributes') | |
def add_attributes(field, css): | |
attrs = {} | |
definition = css.split(',') |
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
{% assign minutes = content | number_of_words | divided_by: 180 %} | |
{% if minutes == 0 %} | |
{% assign minutes = 1 %} | |
{% endif %} |
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
ssh server | |
cd /var/www/prod/{project} | |
source /opt/venvs/{project}/bin/activate | |
sudo -u www-data git pull origin master | |
python manage.py collectstatic | |
sudo supervisorctl restart {project} |
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
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |
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
## To copy a file from remote to local | |
`scp user@remote:/foo/bar/folder /home/bar/folder` | |
## To copy a folder from remote to local | |
`scp -r user@remote:/foo/bar/folder /home/bar/folder` | |
This uses a recursive copy |
OlderNewer