Skip to content

Instantly share code, notes, and snippets.

View raprasad's full-sized avatar

Raman Prasad raprasad

View GitHub Profile
@raprasad
raprasad / response1-success.md
Created March 14, 2018 19:24
create pipelines resp 1
[{"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "27a0f05d-fc46-4497-bc55-ecfd27e52e83"}, {"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "22548ad8-b38c-4145-9656-f8e7d555c4b4"}, {"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "2f7688a0-e121-463c-89bf-585b1848ff3d"}, {"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "244ce547-5ec3-4f5e-a0c3-1a0efff6e269"}, {"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "de7ed878-e475-454a-93b3-a6d1ba95757f"}, {"responseInfo": {"status": {"code": "OK", "details": "Pipeline Submitted"}}, "progressInfo": "SUBMITTED", "pipelineId": "27b5f716-8275-465d-819e-a6c135a14e47"}, {"responseInfo": {"status": {"code": "OK",
{
   "context":{
      "session_id":"e866d1b6-dab8-467c-a14f-b3e4956fdd8a"
   },
   "dataset_uri":"/ravens_volume/test_data/1491_one_hundred_plants_margin/TRAIN/dataset_TRAIN/datasetDoc.json",
   "task":"CLASSIFICATION",
   "taskSubtype":"MULTICLASS",
   "taskDescription":"",
   "output":"OUTPUT_TYPE_UNDEFINED",
@raprasad
raprasad / some_stuff.md
Last active February 1, 2018 20:29
django file rename?
    def save(self, *args, **kwargs):
        """pseudocode for renaming a file
            self.my_file - django FileField
        """
        if not self.id: # is it saved yet?  I need an id
            super(MyModel, self).save(*args, **kwargs)
        
 # This is the file name I want
@raprasad
raprasad / change_password.md
Last active March 15, 2024 17:21
django user; change password from shell

update django password

general changes

To use in dev environments

  • after python manage.py shell
from django.contrib.auth.models import User
@raprasad
raprasad / rename_files.py
Created November 7, 2017 15:52
rename files
"""
Recursively check directories to rename files.
Files ending with "_db.xml" are renamed "dublin_core.xml"
(1) Shows files that will be renamed. DOESN'T actually rename files.
>python rename_files.py [base_directory]
(2) Include "rename" to actually rename the files.
>python rename_files.py [base_directory] rename
@raprasad
raprasad / workflow.md
Created October 18, 2017 21:08
Developement tools

Tools for TwoRavens Development

At the TwoRavens project grows in regard to functionality, complexity, number of developers, and the broad range of deliverables (both grant related and strategic), developer workflow becomes more important.

As demonstrated in previous TwoRavens development, code management is a critical component of this workflow. This document seeks to identify components as well as describing several options to accomplish a workflow with these components.

The overall goal is to track development in a way that allows the TwoRavens project to meet its grant obligations as well as the larger goal of becoming a widely-used teach tool for students.

Components of a Development Workflow:

@raprasad
raprasad / embed_note.md
Last active October 13, 2017 14:36
data embed formatting

This note is for PipelineExecuteResult (in JSON format) and similar structures that contain Uris to result files.

Last month we decided to embed the contents of the result file(s) into the JSON response sent back to the UI. For example:

  • If you see a file uri:
{
    "progressInfo": "COMPLETED",
    "pipelineId": "pipeline_1",
@raprasad
raprasad / dockerfile
Created October 3, 2017 03:12
dockerfile test
# Note: This only runs the Django app, not the rook services
FROM ubuntu:16.04
MAINTAINER Raman Prasad (raman_prasad@harvard.edu)
LABEL organization="Two Ravens" \
2ra.vn.version="0.0.1-beta" \
2ra.vn.release-date="2017-09-20" \
description="Image for the Two Ravens python service which serves the UI."
# -------------------------------------
@raprasad
raprasad / remove_users.md
Created June 26, 2017 19:13
remove authenticated users from db

Queries to remove most AuthenticatedUsers

Prereq deletes

delete from usernotification where user_id > 9;
delete from apitoken where authenticateduser_id > 9;
delete from authenticateduserlookup where authenticateduser_id > 9;
delete from confirmemaildata where authenticateduser_id > 9;
@raprasad
raprasad / pb_tbl.md
Created June 1, 2017 13:14
postgres copy table from 1 db to another

Copy from source table: dvn_thedata -> authenticateduser

  • Go to the psql shell: psql dvn_thedata
  • Copy to a text file:
\copy (select id, affiliation, email, firstname, lastname, modificationtime, position, superuser, useridentifier from authenticateduser order by id) to '/tmp/auth_user.csv' CSV HEADER