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
# 1. Check Services | |
# - NGINX | |
sudo nginx -t | |
sudo service nginx status | |
sudo service uwsgi status | |
# 2. Logs for Errors | |
tail /var/log/nginx/access.fifo | |
tail /var/log/nginx/error.fifo |
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
# My favorite logging settings | |
# ----------------------------------------------------------------------------- | |
# LOGGING | |
# ----------------------------------------------------------------------------- | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'propagate': 1, | |
'filters': { |
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
server { | |
.... | |
location ~ /media/([a-zA-Z0-9\-_\/\.]+)$ { | |
root /var/www/mysite/; | |
try_files /media/$1 /uploads/$1 =404; | |
} |
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 django import forms | |
from django.contrib import admin | |
from dal import autocomplete, forward | |
class AdminAutocompleteFormMixin(forms.ModelForm): | |
class Media: | |
js = ('admin/autocomplete/forward.js', | |
'admin/autocomplete/select_admin_autocomplete.js') |
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 hashlib | |
import io | |
import logging | |
import mimetypes | |
import os | |
import re | |
import tempfile | |
from xml.dom import minidom | |
from PIL import Image |
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
// Specifically for use with the Adafruit Feather, the pins are pre-set here! | |
// include SPI, MP3 and SD libraries | |
#include <SPI.h> | |
#include <SD.h> | |
#include <Adafruit_VS1053.h> | |
// These are the pins used | |
#define VS1053_RESET -1 // VS1053 reset pin (not used!) |
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
/* | |
First few bars of Gymnopedia No 1 - very very roughly | |
Requires pitches.h | |
nina@ninalp.com | |
*/ | |
#include "pitches.h" | |
const int speakerPinMelody = 3; |
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
/* | |
First few bars of Woe Is Me (World's Smallest Violin) from Spongebob Square Pants | |
Requires pitches.h | |
nina@ninalp.com | |
*/ | |
#include "pitches.h" | |
const int speakerPinMelody = 26; |
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 | |
# This script will watch a given directory with a .git checkout and execute a deployment if it detects an update. | |
# You can set this up with CRON so that deployments happen automatically. | |
# | |
# Example CRON usage: | |
# crontab -e | |
# */5 * * * * bash /path/to/scripts/deploy.sh | |
# | |
# Example manual usage: | |
# bash /path/to/scripts/deploy.sh force |
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 os.path | |
import os | |
from django.core.management.base import BaseCommand, CommandError | |
from django.core.files.storage import get_storage_class | |
from django.core.files import File | |
from django.conf import settings | |
from django.utils import timezone as tz |