View addresses.py
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 requests | |
import json | |
import csv | |
""" | |
Example Input CSV | |
first_name address1 address2 city state zip email | |
John Doe 111 Middlefield Road Redwood City CA 94063 foo@bar.com | |
Jane Doe 111Middlefield Road Redwood City CA 94063 foo@bar.com | |
""" |
View gist:fab72b5e30f7c8f01f1d1d09e403176b
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 sys | |
import pandas as pd | |
import numpy as np | |
import time | |
import sqlalchemy as sa | |
import gc | |
from guppy import hpy | |
def obj_size_fmt(num): |
View app.py
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 page_1 import * | |
from page_2 import * | |
server = app.server | |
if __name__ == '__main__': | |
app.run_server(debug=True) |
View failure.py
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
==================================================================================================== FAILURES ===================================================================================================== | |
_________________________________________________________________________________________ test_custom_view_with_ordering __________________________________________________________________________________________ | |
token = <Token: 5502f6196a82da5016b0c5b58ee83cd02968c6d9> | |
examplefortesting = [<ExampleForTesting: ExampleForTesting object (150)>, <ExampleForTesting: ExampleForTesting object (151)>, <ExampleFor...bject (152)>, <ExampleForTesting: ExampleForTesting object (153)>, <ExampleForTesting: ExampleForTesting object (154)>] | |
@pytest.mark.django_db | |
def test_custom_view_with_ordering(token, examplefortesting): | |
"""Test ordering query returns csv with specified order""" |
View wtf.py
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
(data_warehouse) | |
┌───=[ mikela :: debian -( 0 )-[ ~/pivot/data_warehouse ] | |
└──(python --version | |
Python 3.7.1 | |
(data_warehouse) | |
┌───=[ mikela :: debian -( 0 )-[ ~/pivot/data_warehouse ] | |
└──(ipython | |
Python 3.7.1 (default, Oct 23 2018, 19:19:42) | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help. |
View gist:d38c37a4ab6ac3b9fc6a7e4c10082fbf
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
- name: Compile assets | |
shell: 'source /home/rails/.bashrc && env | grep RBENV' | |
args: | |
chdir: "/home/rails/lims" | |
executable: /bin/sh | |
become_user: rails |
View admin.py
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.contrib import admin | |
from django.apps import apps | |
from bulk_importer import models | |
BULKABLE_MODELS = [] | |
class BulkableAdmin(admin.ModelAdmin): | |
readonly_fields = ('created_at', 'updated_at', 'imported_from') |
View form.py
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
def get_form_from_model_name(full_model_name): | |
app_label, model_name = full_model_name.split(".") | |
form_model = apps.get_model(app_label, model_name) | |
fields = form_model._meta.fields | |
name_fields = [] | |
for field in fields: | |
if field.related_model and (issubclass( | |
field.related_model, | |
bi_models.NamedBulkable) or issubclass( |
View gist:ecfbb08b5b26c6099c7bed4cee62c888
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
create user django with password 'password'; | |
create schema django authorization django; | |
create user rails with password 'password'; | |
create schema rails authorization rails; | |
create extension hstore; | |
create extension pg_trgm schema rails; | |
grant USAGE on SCHEMA rails to django; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA rails revoke all on tables from django; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA rails grant select on tables to django; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA rails revoke all on sequences from django; |
View gist:ae40c7bc8971537e388a74cf1ff7cc7a
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
data_warehouse=# \ddp | |
Default access privileges | |
Owner | Schema | Type | Access privileges | |
--------+--------+-------+------------------- | |
mikela | rails | table | django=r/mikela | |
(1 row) |
NewerOlder