Skip to content

Instantly share code, notes, and snippets.

View raprasad's full-sized avatar

Raman Prasad raprasad

View GitHub Profile
@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 / 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 / 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 / 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:
@raprasad
raprasad / file_check.py
Last active November 28, 2018 18:23
Script to check that crime incidents exist
"""python3 script to check data files
For use with New Haven Crime Files on Dataverse:
- https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/18J4ZW
"""
import json
from os.path import isfile
import sys
# --------------------------------------------
# SET YOUR DATA DIRECTORY HERE CONTAINING these files:
@raprasad
raprasad / ed_queries.md
Last active August 23, 2018 16:29
EventData saved queries

Saved Queries for Event Data

Specifically, before seeing the app in action, I thought of these as two distinct parts:

  • (a) Saving/Retrieving queries to the database
  • (b) Running queries and storing the results in Dataverse
    • Run mongo query
    • Write result to a temporary file
    • Push the file and a related readme file to Dataverse
    • Publish the Dataset, allowing the new file to be publicly viewable
@raprasad
raprasad / ta3_data.md
Last active August 8, 2018 22:44
shareable csv data endpoint
@raprasad
raprasad / add-file.md
Created July 24, 2018 18:25
add file
from datetime import datetime
import json
import requests  # http://docs.python-requests.org/en/master/

# --------------------------------------------------
# Update the 4 params below to run this code
# --------------------------------------------------
dataverse_server = 'https://your dataverse server' # no trailing slash
api_key = 'api key'