Skip to content

Instantly share code, notes, and snippets.

View prashanthmadi's full-sized avatar

Prashanth Madi prashanthmadi

View GitHub Profile
@prashanthmadi
prashanthmadi / install_anaconda_new_python_hdi.sh
Created May 14, 2019 03:49
install newer version of python in anaconda for HDInsight
/usr/bin/anaconda/bin/conda create --prefix /usr/bin/anaconda/envs/py37 python=3.7
@prashanthmadi
prashanthmadi / create_db_col_cosmos_mongo.py
Last active May 3, 2019 04:01
Create Database and Collection using pymongo in COSMOSDB
from pymongo import MongoClient
client = MongoClient('mongodb://testmongoapr:xx==@testmongoapr.documents.azure.com:10255/?ssl=true&replicaSet=globaldb')
# Creating Database
db = client.testdb
db.command({ 'customAction': "CreateDatabase" })
#creates Fixed Storage Collection
db.command({'customAction': "CreateCollection", 'collection': "testCol1", 'offerThroughput': 1000})
#creates Unlimited Storage Collection
db.command({'customAction': "CreateCollection", 'collection': "testCol2", 'offerThroughput': 1000,'shardKey':'country'})
@prashanthmadi
prashanthmadi / cosmos_connect_cassandra.py
Created April 23, 2019 22:24
connect cassandra api in cosmosdb using python (cassandra-driver)
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
import config as cfg
from ssl import PROTOCOL_TLSv1_2
from requests.utils import DEFAULT_CA_BUNDLE_PATH
ssl_opts = {
'ca_certs': DEFAULT_CA_BUNDLE_PATH,
'ssl_version': PROTOCOL_TLSv1_2,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var mongoose = require('mongoose')
const db = mongoose.connect('mongodb://mongo1234:Shrk6VZMbwCjEV0Fwmz2m3qHx3qhdQMAaLw52pKOrWCji2NhOOHEJVM6W51SKiDLv5a5pQRUybwABnGKRwDy4A==@mongo1234.documents.azure.com:10255/d1?ssl=true&replicaSet=globaldb',{useNewUrlParser: true});
var Schema = mongoose.Schema;
var schema = new Schema({ name: String },{ shardKey: { name: 1 }});
const Cat = mongoose.model('Cat',schema);
//Cat.create({name: 'Zildjian'});
const kitty = new Cat({ name: 'Zildjian' });
kitty.save().then(() => console.log('meow'));
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents;
using Microsoft.Azure;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"workspaceName": {
"type": "string"
},
"use strict";
const cassandra = require('cassandra-driver');
const async = require('async');
const assert = require('assert');
var tls = require('tls');
var fs = require('fs');
var config = require('./config');
var ssl_option = {
@prashanthmadi
prashanthmadi / databricks_pyodbc.sh
Created October 25, 2018 23:15
Init script for installing pyodbc on databricks
sudo apt-get -y install unixodbc-dev
python -m pip install pyodbc