Skip to content

Instantly share code, notes, and snippets.

Create xml file .../spark-3.0.0-bin-hadoop2.7/conf/hive-site.xml

<configuration> 
    <property> 
      <name>hive.metastore.warehouse.dir</name> 
      <value>/Users/deepakjayaprakash/Downloads/spark_database/</value> 
    </property> 
  </configuration>

Save

@j-thepac
j-thepac / Coding Principles.md
Last active May 19, 2024 13:43
Coding Principles

Principles

  • Loose Coupling
  • High Cohesion
  • Change is Local
  • It is Easy to Remove

Smells

  • Rigidity ( A -> B -> C . something hardcoded in C )
  • Fragility
  • Immobility

postgres-Django

Ref:Tutorial

Azure App Service

Creat APP

    git clone https://github.com/Azure-Samples/djangoapp
    cd djangoapp
    az webapp up \

--resource-group DjangoPostgres-tutorial-rg \

az extension add --name db-up --debug

Error:

Building wheel for pymssql (PEP 517): finished with status 'error'
  ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly

Exception information:

Azure Static page:

Azure App Service

git clone https://github.com/Azure-Samples/html-docs-hello-world.git
cd html-docs-hello-world
az webapp up --location westeurope --name <app_name> --html
go to the app URL: http://<app_name>.azurewebsites.net

Update and redeploy the app

az webapp up --location westeurope --name --html

Create Webapp using Flask

Azure App Service

Pre-Req

  • Make Sure u have setup account created for Azure
  • You have enabled Free Subscription
  • You have created a webapp instance manullay example "flaskserverpushparanimptest2"

Setup Env

$brew update && brew install azure-cli

$az upgrade

@j-thepac
j-thepac / cosmosapi.py
Created January 3, 2022 12:13
CosmosDB Api
"""
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/create-sql-api-python
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cosmos/azure-cosmos/samples/examples.py
Pre-Req:
pip install --pre azure-cosmos
Have a Azure Account with Free Subscribption Enabled
Make sure Cosmosa DB is created along with DB and Container
#Azure portal > Azure Cosmos > ck on Existing Cosmos Db > Settings > Keys
@j-thepac
j-thepac / SimpleFunctor.scala
Last active December 18, 2021 15:20
SimpleFunctor
case class Bag[Int](a: Int) {
def map[Double](f: Int => Double): Bag[Double] = Bag(f(a))
}
val f = i:Int => i/1.0
Bag(10).map( i=> f(i))//result =Bag(10.0)
@j-thepac
j-thepac / Monad.scala
Created December 18, 2021 15:16
Monad and Functor
//https://medium.com/beingprofessional/understanding-functor-and-monad-with-a-bag-of-peanuts-8fa702b3f69e
object Monad extends App {
// Functor + unit+ Flatmap = Monad
case class Sugar(weight: Int)
case class Bag[A](content: A) {
def map[B](f: A => B): Bag[B] = Bag(f(content))
def flatMap[B](f: A => Bag[B]): Bag[B] = f(content)
}
@j-thepac
j-thepac / scala_rules.scala
Created December 15, 2021 16:57
Scala Rules
// They’re an idiomatic way of representing data using “ands” and “ors”. For example:
// a shape is a rectangle or a circle
// a rectangle has a width and a height
// a circle has a radius
// In ADT (Algebraic Data Types (ADTs))terminology, “and” types such as rectangle and circle are products,
// whereas the “or” types such as shape are coproducts.
// In Scala, we typically represent products using case classes and coproducts using sealed traits: