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
javascript: (async function() { | |
var bookmarkletVersion = "1.0.0"; | |
var apiRoot = "https://parenting.nytimes.com/api/v1"; | |
var cmsRoot = "https://nyt-parentingcms-prd.appspot.com"; | |
console.log("Running Parenting Edit Bookmarlet v" + bookmarkletVersion); | |
/* | |
Generic function for requesting URLs | |
*/ |
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
import logging | |
from django.core.management.base import BaseCommand, CommandError | |
logger = logging.getLogger('django') | |
class Command(BaseCommand): | |
def handle(self, *args, **options): |
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
# 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 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
# My favorite logging settings | |
# ----------------------------------------------------------------------------- | |
# LOGGING | |
# ----------------------------------------------------------------------------- | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'propagate': 1, | |
'filters': { |
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
server { | |
.... | |
location ~ /media/([a-zA-Z0-9\-_\/\.]+)$ { | |
root /var/www/mysite/; | |
try_files /media/$1 /uploads/$1 =404; | |
} |
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 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 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
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 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
// 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 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
/* | |
First few bars of Gymnopedia No 1 - very very roughly | |
Requires pitches.h | |
[email protected] | |
*/ | |
#include "pitches.h" | |
const int speakerPinMelody = 3; |
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
/* | |
First few bars of Woe Is Me (World's Smallest Violin) from Spongebob Square Pants | |
Requires pitches.h | |
[email protected] | |
*/ | |
#include "pitches.h" | |
const int speakerPinMelody = 26; |