Skip to content

Instantly share code, notes, and snippets.


Mikela glassresistor

View GitHub Profile
glassresistor /
Created Sep 10, 2020
Spliting a dash app into modules
from page_1 import *
from page_2 import *
server = app.server
if __name__ == '__main__':
==================================================================================================== 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)>]
def test_custom_view_with_ordering(token, examplefortesting):
"""Test ordering query returns csv with specified order"""
┌───=[ mikela :: debian -( 0 )-[ ~/pivot/data_warehouse ]
└──(python --version
Python 3.7.1
┌───=[ mikela :: debian -( 0 )-[ ~/pivot/data_warehouse ]
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
- name: Compile assets
shell: 'source /home/rails/.bashrc && env | grep RBENV'
chdir: "/home/rails/lims"
executable: /bin/sh
become_user: rails
from django.contrib import admin
from django.apps import apps
from bulk_importer import models
class BulkableAdmin(admin.ModelAdmin):
readonly_fields = ('created_at', 'updated_at', 'imported_from')
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(
bi_models.NamedBulkable) or issubclass(
View gist:ecfbb08b5b26c6099c7bed4cee62c888
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
data_warehouse=# \ddp
Default access privileges
Owner | Schema | Type | Access privileges
mikela | rails | table | django=r/mikela
(1 row)
View gist:2c1e5c4a999eb9d48b555f129eb2aad2
CREATE OR REPLACE FUNCTION remove_words(message text) RETURNS SETOF text AS $$
RETURN QUERY select * from regexp_split_to_table(message, E'\\s+') except select boring_words.word from boring_words where boring_words.word = ANY(regexp_split_to_array(message, E'\\s+'));
$$ LANGUAGE plpgsql;
View gist:b14b3707cb8b0b21ec04219ac7e94916
-rw-r--r-- 1 root root 29M Aug 1 18:21 initrd.img-3.16.0-4-amd64.old-dkms
-rw-r--r-- 1 root root 32M Nov 21 10:47 initrd.img-4.9.0-0.bpo.2-amd64.old-dkms
-rw-r--r-- 1 root root 32M Nov 21 10:29 initrd.img-4.9.0-0.bpo.3-amd64.old-dkms