Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
💫
- GitHub Staff
- https://gazit.me
- @[email protected]
- @idangazit
This file contains hidden or 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 django.db import models | |
| from django import forms | |
| from django.utils.translation import ugettext_lazy as _ | |
| class HexField(models.CharField): | |
| def __init__(self, *args, **kwargs): | |
| self.min_length = kwargs.pop('min_length', None) | |
| super(HexField, self).__init__(*args, **kwargs) | |
| def formfield(self, **kwargs): |
This file contains hidden or 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
| projname/ | |
| django_wsgi.py | |
| fabfile.py | |
| static/ | |
| venv/ # virtualenv dir | |
| docs/ | |
| index.rst | |
| foo.rst | |
| ... more docs ... | |
| Makefile |
This file contains hidden or 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
| upstream wsgidav { | |
| server unix:/tmp/wsgidav.sock fail_timeout=0; | |
| } | |
| # non-HTTPS redirect elided... | |
| server { | |
| listen 443; | |
| server_name dav.domain.com; | |
| access_log /var/log/nginx/dav.domain.com.access.log; |
This file contains hidden or 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
| <style> | |
| label { | |
| display: block; | |
| } | |
| label strong.error { | |
| color: red; | |
| } | |
| </style> |
This file contains hidden or 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-dss AAAAB3NzaC1kc3MAAACBALeU9u8x5LaI1sGk0KhU7GdTGpkTQk0U+Rvg9meIVRF90WFKyH8T/FTIPV/2hB4h6ZqaFDGnzzY3E9coAHrCSgRjcWUWq8syP3U1wPfc0IoD9j4U32RJg7fS5J4oiy9z3T5icPsjvTRrjgBP7yu71W6htxXmLxI49QCqQpZgxet9AAAAFQCnK+jJZnRpCcoy9unt6VeNkv2RoQAAAIACsX0oGjteg8rpocY+oN6uudKl1oIN9Ad5W9zdRYlA9ZdM9ZvCcitRuRx2DWYyKaTqAf8T0z+9aHySqJ68gpZpTTHgBM4rC7CLfjk8VCPCqdYTBUNNEuRAW2Ef7KsIrICNx7RoCkrigBshyu+XyOAGmKBch0kFMxNi8cKzHTobrgAAAIAp7OQeQ+g8Pl9fJ9WO14eq1Yo9SpeazHNt+BOIqxZWjx34CJes9tx+kY1WAweN3Vzk7JXmj6fSMKAib/TigvjVz+jrGDkFSNP+W9VscA7apCQlNytI3N6RjOuFbql5kVn6N8a+gfVEPY/zelkd7+9rrWSRnQFE0DOMkCnHclcRNw== [email protected] |
This file contains hidden or 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
| [program:znc] | |
| command=/usr/local/bin/znc -fn | |
| user=idan |
This file contains hidden or 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 django.core.exceptions import ValidationError | |
| from django.core.validators import EMPTY_VALUES | |
| from django.utils.unittest import TestCase | |
| class LocalFlavorTestCase(TestCase): | |
| def assertFieldOutput(self, fieldclass, valid, invalid): | |
| """Asserts that a field behaves correctly with various inputs. | |
| Args: | |
| fieldclass: the class of the field to be tested. |
This file contains hidden or 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
| 11/1/10 1:58:38 PM iCal[46912] -[DAVRequest:0x1163f6000 _readStreamEvent:] READ | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <D:multistatus xmlns:D="DAV:"> | |
| <D:response> | |
| <D:href>/calendar/dav/idan%40skillsapp.com/events/cl88lbiu0s8bl19a4hl06qhunc%40google.com.ics</D:href> | |
| <D:propstat> | |
| <D:status>HTTP/1.1 200 OK</D:status> | |
| <D:prop> | |
| <D:getetag>"63424295909"</D:getetag> | |
| <C:calendar-data xmlns:C="urn:ietf:params:xml:ns:caldav">BEGIN:VCALENDAR |
This file contains hidden or 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
| def gunicorn_pid(): | |
| """Gets the PID of a supervisord-managed gunicorn""" | |
| result = sudo('supervisorctl status %s' % env.proj_name) | |
| m = re.search(r'pid (?P<pid>\d+)', result) | |
| if m: | |
| return m.group('pid') or None | |
| def gunicorn_hup(): | |
| """Sends HUP to gunicorn in order to gracefully restart the servers""" | |
| pid = gunicorn_pid() |