Skip to content

Instantly share code, notes, and snippets.

View Nilkanta's full-sized avatar

Nilkanta Dasadhikari Nilkanta

View GitHub Profile
@Nilkanta
Nilkanta / script.py
Created December 18, 2017 10:25 — forked from saiteja09/script.py
Glue Job Script for reading data from DataDirect Salesforce JDBC driver and write it to S3
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.dynamicframe import DynamicFrame
from awsglue.job import Job
args = getResolvedOptions(sys.argv, ['JOB_NAME'])
@Nilkanta
Nilkanta / GmailSendMail.psi
Created September 8, 2017 10:26 — forked from LindaLawton/GmailSendMail.psi
Step by step guild to using power shell to get a Google access token.
clear-host;
#Remove-Variable * -ErrorAction SilentlyContinue
#get-item Variable:*
#Get-Variable | Select-Object -ExpandProperty Name
. C:\Users\linda_l\Desktop\PowerShell\GoogleOauth.ps1
Add-Type -Path "C:\Users\linda_l\Documents\visual studio 2015\Projects\TestingLibrary\packages\AE.Net.Mail.1.7.10.0\lib\net45\AE.Net.Mail.dll"
Add-Type -AssemblyName System.IO
Add-Type -AssemblyName System.Text.Encoding
@Nilkanta
Nilkanta / csv-to-json.js
Created August 2, 2017 15:29 — forked from iwek/csv-to-json.js
CSV to JSON Conversion in JavaScript
//var csv is the CSV file with headers
function csvJSON(csv){
var lines=csv.split("\n");
var result = [];
var headers=lines[0].split(",");
for(var i=1;i<lines.length;i++){
@Nilkanta
Nilkanta / mongodb-array-to-doc
Created June 29, 2017 17:42 — forked from abn/mongodb-array-to-doc
Mongodb: convert a an array into a sub-document. Eg: { "field" : ["v1", "v2", ...], 'date' : $DATE } to { "field" : { "v1" : $DATE, "v2" : $DATE, ... } , 'date' : $DATE}
db.collection.find({ field : { $exists : true } }).forEach( function (x) {
var temp = {}
var count = 0
for (var i in x.field) {
if (typeof x.field[i] == "string") {
// make sure index is a string
temp[x.field[i]] = x.date;
count++;
}