Skip to content

Instantly share code, notes, and snippets.

View raprasad's full-sized avatar

Raman Prasad raprasad

View GitHub Profile
@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 / pca_demo_snip.py
Last active December 21, 2023 18:26
PCA snippet
"""
This snippet may be used after installing the following libraries:
# (1) OpenDP library with DP-PCA
# - reference: https://test.pypi.org/project/opendp/0.9.0.dev20231221001/
#
pip install -i https://test.pypi.org/simple/ opendp==0.9.0.dev20231221001
# (2) scikit-learn (includes numpy)
#
@raprasad
raprasad / test_unmanaged_models.md
Last active November 1, 2023 00:04
Ignoring migrations during Django testing (unmanaged databases, legacy databases, etc)

Scenario

  • Django 1.9 application with two databases:
    • Legacy database with readonly access via unmanaged models. Both Django models (models.py) and related migrations have "managed" set to False
      • 'managed': False
    • Default database holding django specific tables (e.g. auth_user, django_content_type, etc)

Testing Woes

@raprasad
raprasad / jinjava.md
Last active January 31, 2021 10:07
jinjava example
  • pom.xml
 <dependency>
               <groupId>com.hubspot.jinjava</groupId>
               <artifactId>jinjava</artifactId>
               <version>2.2.0</version>
             </dependency>
@raprasad
raprasad / hba_note.md
Last active January 16, 2021 17:06
Postgres: Update pg_hba.conf for Static IP

Find pg_hba.conf file location

bash-4.1$ psql
psql (8.4.20)
Type "help" for help.

postgres=# SHOW hba_file;
            hba_file             
@raprasad
raprasad / index.html
Last active August 27, 2020 22:24
Vue/Bootstrap Template
<div id="app">
<nav class="navbar navbar-light fixed-top">
<div class="navbar-text ml-auto d-flex">
<button class="btn btn-sm btn-outline-success"
@click="sliderStatus = !sliderStatus">
<i class="fas fa-dollar-sign"></i></button>
<div class="dropdown ml-2" v-if="cart.length>0">
<button class="btn btn-success btn-sm dropdown-toggle"
id="cartDropdown" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
@raprasad
raprasad / index.html
Created August 27, 2020 22:23
Vue/Bootstrap Template
<div id="app">
<nav class="navbar navbar-light fixed-top">
<div class="navbar-text ml-auto d-flex">
<button class="btn btn-sm btn-outline-success"
@click="sliderStatus = !sliderStatus">
<i class="fas fa-dollar-sign"></i></button>
<div class="dropdown ml-2" v-if="cart.length>0">
<button class="btn btn-success btn-sm dropdown-toggle"
id="cartDropdown" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
@raprasad
raprasad / nyu-augment.md
Last active June 24, 2019 20:28
nyu augment

Augment via REST and python requests

def run_augment_test():
    """Augment via REST"""

    # Query result
    #
@raprasad
raprasad / isi-DA_college_debt.md
Created April 29, 2019 16:06
ISI error with DA_college_debt
  • Dataset: DA_college_debt

(1) Initial request

{
    "userAgent": "TwoRavens",
    "version": "2019.2.27",
@raprasad
raprasad / config-path.md
Created January 7, 2019 19:58
config temp path

Code to get the D3M temp directory accessible by TA2/TA2

from os.path import join
from tworaven_apps.configurations.utils import \
    (get_latest_d3m_config,)

d3m_config = get_latest_d3m_config()
if not d3m_config: