Skip to content

Instantly share code, notes, and snippets.

View saulshanabrook's full-sized avatar
🏊

Saul Shanabrook saulshanabrook

🏊
View GitHub Profile
{
"metadata": {
"name": "",
"signature": "sha256:032716fc53e1db0b5fd33772e65e12acf781992c728b0aa4fde86f7864dfe9d1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:3e7920f8aadc61c152ae38d7218c17697e7c1f46b33fb7b2ddc3c733cb7d530e"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"name": "",
"signature": "sha256:653a4581e6c6179fef75ec32cf4e96c58a6a1305d865384910608a2758ba95e6"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
#!/bin/bash
git clone https://github.com/DamnWidget/anaconda /anaconda
cd /anaconda
git checkout vagrant_server
cat >config.py <<EOF
python_interpreter = "python" # the interpreter to use
project = "anaconda" # the name of the project
extra_paths = None # a list of extra paths
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"metadata": {
"name": "",
"signature": "sha256:dac4c1e908e671b2f9222884d3ed013270055d3ad43e784cf7526efb5a2fd0a4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@saulshanabrook
saulshanabrook / find_fk_doesnt_exist.py
Created April 3, 2015 12:49
Find FK doesnt exist
def find_fk_doesnt_exist(model, field_name):
field = getattr(model, field_name)
related_model = field.field.related.parent_model
available_fk_pks = related_model.objects.values_list('pk', flat=True)
for instance in model.objects.all().exclude(**{field_name + '__isnull': True}):
if getattr(instance, field_name + '_id') not in available_fk_pks:
yield instance
@saulshanabrook
saulshanabrook / script.py
Created April 18, 2015 04:19
Isolate dumpdata failure Django
import sys
import os
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import CommandError
for app in set([path.__module__.split('.')[-2] for path in apps.get_models()]):
try:
print "Trying {}".format(app)
<html><head><title>Lighting Design Doc</title><meta content="text/html; charset=UTF-8" http-equiv="content-type"><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=Zhfjj_gat3waL4JSju74E5KZlXp2NjsiipqDtBkg26Ji-i3ynI8NvFXysMjBstzg');.lst-kix_y291l4i7csd8-0>li{counter-increment:lst-ctn-kix_y291l4i7csd8-0}.lst-kix_m61bwifzx2vm-4>li{counter-increment:lst-ctn-kix_m61bwifzx2vm-4}.lst-kix_y291l4i7csd8-6>li:before{content:"" counter(lst-ctn-kix_y291l4i7csd8-6,decimal) ". "}.lst-kix_mrkaejkow017-7>li:before{content:"" counter(lst-ctn-kix_mrkaejkow017-7,lower-latin) ". "}.lst-kix_z1o4bed65pky-4>li{counter-increment:lst-ctn-kix_z1o4bed65pky-4}.lst-kix_mrkaejkow017-8>li:before{content:"" counter(lst-ctn-kix_mrkaejkow017-8,lower-roman) ". "}.lst-kix_m61bwifzx2vm-2>li{counter-increment:lst-ctn-kix_m61bwifzx2vm-2}ol.lst-kix_mrkaejkow017-0.start{counter-reset:lst-ctn-kix_mrkaejkow017-0 0}.lst-kix_m61bwifzx2vm-4>li:before{content:"" counter(lst-ctn-kix_m61bwifzx2vm-4,lower-latin) ". "}.lst-k
{
local: {
cues: {
new: newCue(),
$newValid: [
['local', 'cues', 'new'],
['local', 'cues', '$allNames'],
(cue, allCueNames) => cue && (cue.name || '').length > 0 && !_.includes(allCueNames, cue.name)
],
$count: [