Skip to content

Instantly share code, notes, and snippets.

View Laxman-SM's full-sized avatar

Laxman Singh Laxman-SM

  • Ex-Phenome, Ex-Intertrust, Ex-Wipro
  • US, Hyderabad (india)
View GitHub Profile
@Laxman-SM
Laxman-SM / Dockerfile
Created February 3, 2020 09:22 — forked from ealebed/Dockerfile
Airflow_Kubernetes
FROM python:3.7-slim-stretch
LABEL maintainer="Yevhen Lebid <[email protected]>"
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND=noninteractive \
TERM=linux
# Airflow
ARG AIRFLOW_VERSION=1.10.7
@Laxman-SM
Laxman-SM / splunk-hec.psm1
Created January 31, 2020 07:32 — forked from halr9000/splunk-hec.psm1
Send-SplunkEvent, a PowerShell cmdlet for sending events to the Splunk HTTP event collector
# TODO: write the help
# TODO: support SSL self-signed certs
# TODO: need to validate JSON, and/or add a new param set that accepts hashtable and
# convert internally.
# TODO: support RAW mode
# TODO: refactor to use EC batch (concatenated events in one HTTP request) instead of
# PowerShell pipelines which will do a request per object (event payload) on the pipeline
# TODO: think about load balancing per Geoffrey Martins.
@Laxman-SM
Laxman-SM / jupyter_pyspark.md
Created January 28, 2020 21:35 — forked from pierdom/jupyter_pyspark.md
[Run Jupyter with Pyspark integration] This how-to assumes that pyspark is installed and correctly configured to access the cluster (or the stand-alone configuration). Jupyter and other Python packages are executed in a virtualenv. #python #spark #bigdata #sysadmin

Jupyter + Pyspark how-to

Version 1.0 2016/11/14
Pierdomenico Fiadino | [email protected]

Synopysis

Install Jupyter Notebook in a dedicated Python virtualenv and integrate with Spark terminal pyspark on a cluster client (for this example, we will use the tourism-lab node).

This how-to assumes that we have SSH access to the machine and pyspark already installed and configure (try executing it and see if the variables sc, HiveContext and sqlContext are already installed).

@Laxman-SM
Laxman-SM / install-jupyter.sh
Created January 28, 2020 21:29 — forked from cosmincatalin/install-jupyter.sh
AWS EMR bootstraps to install Jupyter (R, SparkR, Python 2, Python 3, PySpark)
#!/bin/bash
MINICONDA_VERSION="4.3.21"
PANDAS_VERSION="0.20.3"
SCIKIT_VERSION="0.19.0"
while [[ $# > 1 ]]; do
key="$1"
case $key in
@Laxman-SM
Laxman-SM / python_example.py
Created January 24, 2020 13:41 — forked from WhatsARanjit/python_example.py
Python script for Vault IAM auth
#!/usr/bin/env python
import boto3
import json
import base64
import requests
import os
def headers_to_go_style(headers):
retval = {}
for k, v in headers.items():
#############################
# ec2 instance
#############################
resource "aws_instance" "nt-test-ec2" {
count = 1
ami = "${lookup(var.ami, var.region)}"
instance_type = "t2.medium"
key_name = "${var.key_pair_name}"
#ebs_optimized = true
@Laxman-SM
Laxman-SM / 0. Prerequisites.sql
Created January 24, 2020 09:45 — forked from ahkim/0. Prerequisites.sql
These code snippets are to demonstrate how you should use PolyBase in step by step. You should have a blob storage and storage secret handy beforehand and execute this from SQL Server 2016 or Azure DW, etc.
DECLARE @serverName VARCHAR(20)
DECLARE @storageSecret VARCHAR(MAX)
DECLARE @storageLocation VARCHAR(MAX)
SET @serverName = convert(VARCHAR(20),(SELECT SERVERPROPERTY('ServerName')))
IF(@serverName = 'peet-bi-dev')
BEGIN
SET @storageSecret = '{your_own_secret}'
SET @storageLocation = 'wasbs://{container_name}@{storage_name}.blob.core.windows.net'
@Laxman-SM
Laxman-SM / ManipulateADF.ps1
Created January 24, 2020 09:44 — forked from ahkim/ManipulateADF.ps1
Useful powershell cmdlets for Azure Data Factory
#
# ManipulateADF.ps1
#
# automate log-in
$resourceGroupName = "{your_resource_group}"
$azureAccountName = '{your_email}'
$azurePassword = ConvertTo-SecureString '{your_password}' -AsPlainText -Force
$azureRMCredential = New-Object System.Management.Automation.PSCredential($azureAccountName, $azurePassword)
$account = Login-AzureRmAccount -Credential $azureRMCredential

Azure DevOps CI/CD with Data Factory

Create a Data Factory pipeline in our Azure Portal

In this example, we have one simple copy activity.

  • Please note on the upper left hand corner, github is already set as the default repository
  • Currently, the branch is pointing at Master
  • Click the drop down on the New Branch or [Alt-N]
  • Enter a new feature Branch
  • Example "Thirdcopybranch Branch"
@Laxman-SM
Laxman-SM / Cosmos DB SQL queries.md
Created January 24, 2020 09:29 — forked from mifung/Cosmos DB SQL queries.md
Cheat Sheet for Cosmos DB SQL queries

Notes

  • Search text is case sensitive
  • Try to force attribute and text in your search to be in the same case
  • Wildcard search use STARTSWITH and ENDSWITH
  • two different types of nulls:
  • missing elements
  • actual null values.
  • Use IS_NULL()and IS_DEFINED() functions, to detect missing attributes and ternary logic
  • Cosmos DB SQL currently does not have an equivalent of SQL LEFT() function. Instead, use SUBSTRING()
  • There is no Year() function in Cosmos DB SQL, use SUBSTRING() to the date string and isolate