Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
"""Define a management command to handle safe migrations."""
from __future__ import print_function
import sys
from django.core.cache import cache
from django.core.management import call_command
from django.core.management.base import BaseCommand
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
def __unicode__
@nicholasserra
nicholasserra / nhl.py
Created August 26, 2019 02:30
Crawl nhl videos
#!/usr/bin/env python
import json
import subprocess
try:
from urllib.request import Request, urlopen
except ImportError:
from urllib2 import Request, urlopen
wget \
--recursive \
--header="Accept: text/html" \
--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains digitalfaq.com \
@nicholasserra
nicholasserra / saucelabs_to_depicted.py
Created July 26, 2017 17:36
Upload saucelabs screenshots to depicted for comparison
import sys
from optparse import make_option
from StringIO import StringIO
from PIL import Image
import requests
from django.conf import settings
@nicholasserra
nicholasserra / zookeeper-kafka
Created March 29, 2017 20:24 — forked from mesonoxian/zookeeper-kafka
Simple Zookeeper and Kafka init.d Startup Script
#! /bin/bash
### BEGIN INIT INFO
# Provides: kafka
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: kafka service
### END INIT INFO
@nicholasserra
nicholasserra / kafka
Created March 29, 2017 20:10 — forked from superscott/kafka
Simple Kafka Ubuntu init.d Startup Script
DAEMON_PATH=/opt/kafka/bin
DAEMON_NAME=kafka
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$DAEMON_PATH
# See how we were called.
case "$1" in
start)
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
@nicholasserra
nicholasserra / settings_test_snippet.py
Created February 18, 2016 21:56 — forked from NotSqrt/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@nicholasserra
nicholasserra / gist:ff097fddf72b64794c78
Created March 18, 2015 19:02
Pull Requests API response
[{
"body": "Pull request body",
"items": [
9239
],
"number": 1799,
"user": {
"first_name": "Nicholas",
"last_name": "Serra",
"created_at": "2011-12-10T19:28:42+00:00",