Skip to content

Instantly share code, notes, and snippets.

View sksundaram-learning's full-sized avatar

Sundaram Surampudi sksundaram-learning

  • Toronto, Canada
View GitHub Profile
@sksundaram-learning
sksundaram-learning / TSQL-to-POCO
Created March 22, 2018 17:34 — forked from joey-qc/TSQL-to-POCO
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@sksundaram-learning
sksundaram-learning / android_jupyter_install.sh
Created February 2, 2018 02:18 — forked from Breta01/android_jupyter_install.sh
Run clear GNURoot Debian, download android_jupyter_install.sh and run command: sh android_jupyter_install.sh
#!/bin/bash
# Update
apt-get update && apt-get upgrade -y
# Install python+packages and curl
apt-get install -y python3 python3-pip python3-numpy python3-scipy python3-matplotlib ipython3 ipython3-notebook python3-pandas python3-nose curl wget
# Update pip
python3 -m easy_install -U pip
# Correctinng python file
# which causes stuck during package installation
@sksundaram-learning
sksundaram-learning / pandas_dbms.py
Created November 12, 2017 04:19 — forked from catawbasam/pandas_dbms.py
Python PANDAS : load and save Dataframes to sqlite, MySQL, Oracle, Postgres
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
pyspark_udf.py
==============
from pyspark.sql.types import StringType
from pyspark.sql.functions import udf
maturity_udf = udf(lambda age: "adult" if age >=18 else "child", StringType())
df = sqlContext.createDataFrame([{'name': 'Alice', 'age': 1}])
df.withColumn("maturity", maturity_udf(df.age))
@sksundaram-learning
sksundaram-learning / file.rb
Created October 9, 2017 13:48
Android created Gist
https://gist.github.com/amirziai/2808d06f59a38138fa2d
{
"metadata": {
"name": "",
"signature": "sha256:a8c266a3e6c4963abeca1c7b7a0656aee2fb5e524912abbc1f083e942694e840"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@sksundaram-learning
sksundaram-learning / geo_interface.rst
Created September 29, 2017 18:09 — forked from sgillies/geo_interface.rst
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@sksundaram-learning
sksundaram-learning / fdups.py
Created September 18, 2017 20:04 — forked from miku/fdups.py
Find duplicate files in python.
# http://stackoverflow.com/questions/748675/finding-duplicate-files-and-removing-them/748908#748908
import sys
import os
import hashlib
def chunk_reader(fobj, chunk_size=1024):
"""Generator that reads a file in chunks of bytes"""
while True:
chunk = fobj.read(chunk_size)
@sksundaram-learning
sksundaram-learning / docker_cheat.md
Created September 12, 2017 14:30 — forked from wsargent/docker_cheat.md
Docker cheat sheet
./bin/drill-embedded                                                                                           
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Apr 19, 2017 4:53:50 PM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.8 2014-04-29 01:25:26...
apache drill 1.10.0 
"drill baby drill"

Now visit link http://localhost:8047 to open up Apache Drill explorer and configure S3 storage plugin refer