Skip to content

Instantly share code, notes, and snippets.

View P7h's full-sized avatar

Prashanth Babu P7h

  • London, UK
View GitHub Profile
@P7h
P7h / LifeExpectancyAtBirth.csv
Created April 25, 2015 00:40
Life expectancy at birth - Module 6 exercise [multi-linechart]
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37
@P7h
P7h / LargestInSubArrayInAWindow.groovy
Last active April 14, 2016 21:57
Find the largest of a sub-array for a specific window size
int[] arr = [-1, 3, 1, 5,3 ,2 ,1, 0, 7];
int window = 3
int len = arr.length;
for(int i = 0; i< len-window+1; i += 1) {
int[] newarr = new int[window];
for(int j =0 ; j< window; j++){
newarr[j] = arr[i+j];
}
println(getMax(newarr))
@P7h
P7h / LifeExpectancyAtBirth.csv
Created April 18, 2015 22:19
Life expectancy at birth - Module 5 exercise [slopegraph]
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37
@P7h
P7h / LifeExpectancyAtBirth.csv
Last active August 29, 2015 14:19
Life expectancy at birth - Module 5 exercise [scatterplot]
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37
@P7h
P7h / jdk_download_old.sh
Created April 17, 2015 14:19
JDK Download script [earlier version] -- NOT maintaining this anymore. Please check: https://gist.github.com/P7h/9741922
# Commands to download JDK from shell.
# Not maintaining this anymore. Please check: https://gist.github.com/P7h/9741922
# http://stackoverflow.com/questions/10268583
# wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
#JDK8u25
BASE_URL=http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25
@P7h
P7h / FoodDataFinal.csv
Created April 7, 2015 22:51
Food data height issue -- KnightD3 MOOC
Country Rank Score ScoreReversedHighGood UndernourishmentStandard UnderweightStandard EnoughtoEatScore EnoughtoEatScoreReversed FoodPriceLevelStandard FoodPriceInflationStandard AffordScore AffordScoreReversed NutritionDiversityStandard SafeWaterStandard FoodQualityScore FoodQualityScoreReversed DiabetesStandard ObesityStandard UnhealthyEatingScore UnhealthyEatingScoreReversed RawUndernourish RawUnderweight RawFoodPrice RawInflationVolatility RawDietDiversity RawSafeWater RawDiabetes RawObesity Code Region Incomegroup Driver1 Driver2 Driver3 DriverBest DriverBestF Driver1a Driver2a Driver3a DriverWorst DriverWorstF
Netherlands 1 6 94 0 0 0 100 6 7 7 93 3 0 2 98 9 25 17 83 13.3 16.6 2.02 0.039440707 57 74.4 8.8 10.3 NLD Europe & Central Asia High income: OECD 100 100 100 100 Enough to Eat 7 7 17 17 Unhealthy Eating
France 2 8 92 0 0 0 100 14 3 9 91 10 0 5 95 12 24 18 82 4 0.9 2.03 0.082913198 45 97.8 6.3 7.7 FRA Europe & Central Asia High income: OECD 100 100 100 100 Enough to Eat 9 9 18 18 Unhealthy Eating
@P7h
P7h / LifeExpectancyAtBirth.csv
Last active August 29, 2015 14:18
Life expectancy at birth - Module 4 exercise
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37
@P7h
P7h / Sacramento_yearly_tavg.csv
Created April 5, 2015 05:17
Long term (1915-2011) average temperature data for location near Sacramento CA
year tavg
1915 15.877928353357
1916 15.3372481890357
1917 15.9840830951421
1918 15.6915538950237
1919 15.2778507456605
1920 15.2137783316169
1921 16.0093164519457
1922 15.3403901730479
1923 15.7414461778962
@P7h
P7h / LifeExpectancyAtBirth.csv
Last active August 29, 2015 14:18
Life expectancy at birth - Module 3 exercise
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37
@P7h
P7h / LifeExpectancyAtBirth.csv
Last active August 29, 2015 14:17
Life expectancy at birth
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 55 columns, instead of 13. in line 3.
CountryName,CountryCode,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
Aruba,ABW,65.57,65.99,66.37,66.71,67.04,67.37,67.70,68.03,68.38,68.73,69.09,69.45,69.80,70.14,70.47,70.78,71.08,71.38,71.67,71.95,72.22,72.46,72.67,72.85,72.99,73.10,73.18,73.24,73.30,73.34,73.39,73.43,73.47,73.51,73.54,73.56,73.59,73.61,73.64,73.68,73.72,73.78,73.87,73.97,74.09,74.23,74.38,74.53,74.67,74.82,74.95,75.08,75.21
Afghanistan,AFG,31.58,32.10,32.61,33.13,33.64,34.15,34.66,35.17,35.67,36.17,36.66,37.14,37.61,38.07,38.52,38.97,39.41,39.85,40.29,40.75,41.23,41.76,42.34,42.96,43.64,44.38,45.17,46.00,46.85,47.71,48.57,49.40,50.21,50.99,51.71,52.38,52.97,53.51,53.99,54.43,54.85,55.26,55.67,56.11,56.57,57.06,57.57,58.09,58.61,59.11,59.60,60.07,60.51
Angola,AGO,32.98,33.39,33.79,34.19,34.59,34.99,35.40,35.80,36.21,36.61,37