Skip to content

Instantly share code, notes, and snippets.

View sahilbadyal's full-sized avatar

Sahil Badyal sahilbadyal

View GitHub Profile
In Python, function is a group of related statements that perform a specific task.
Functions help break our program into smaller and modular chunks. As our program grows larger and larger, functions make it more organized and manageable.
Furthermore, it avoids repetition and makes code reusable.
Syntax of Function
def function_name(parameters):
"""docstring"""
statement(s)
Above shown is a function definition which consists of following components.
Keyword def marks the start of function header.
@sahilbadyal
sahilbadyal / Run Distributed TF
Created March 5, 2019 11:32
Assumes SSH access allowed between nodes of cluster
#!/bin/bash
##Author: Sahil Badyal <sbadyals@gmail.com>
usage()
{
echo "usage: sysinfo_page [[[-f file ] [-i]] | [-h]]"
}
if [ "1" == "" ]; then
usage
exit
@sahilbadyal
sahilbadyal / EMR BootUp Script for Distributed TF
Last active June 11, 2019 08:02
This script assumes that ssh is allowed between your nodes in cluster
#!/bin/bash
## Author Sahil Badyal <sbadyals@gmail.com>
## This script setups the cluster env for tf
clusterid=$(aws emr list-clusters --active | jq '.Clusters' | jq '.[]' -c | grep <CLUSTER_NAME> | jq '.Id' | tr -d '"')
num=0
tot="$1"
if [ "2" != "" ]; then
numParameterServers="$2"
else