diff --git a/cleaned_file.tsv b/cleaned_file.tsv new file mode 100644 index 00000000..e69de29b diff --git a/convert-bundle.sh b/convert-bundle.sh new file mode 100755 index 00000000..5d9c2290 --- /dev/null +++ b/convert-bundle.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +curl -O https://s3.amazonaws.com/ds2002-resources/labs/lab3-bundle.tar.gz + + +tar -xzf lab3-bundle.tar.gz + + +awk '!/^[[:space:]]*$/' myfile.tsv > cleaned_file.tsv + + +tr '\t' ',' < cleaned_file.tsv > myfile.csv + + +line_count=$(tail -n +2 myfile.csv | wc -l) +echo "Number of rows of data is: $line_count" + +tar -czf converted-archive.tar.gz myfile.csv + + diff --git a/converted-archive.tar.gz b/converted-archive.tar.gz new file mode 100644 index 00000000..48867fb2 Binary files /dev/null and b/converted-archive.tar.gz differ diff --git a/lab3-bundle.tar.gz b/lab3-bundle.tar.gz new file mode 100644 index 00000000..64e46d79 Binary files /dev/null and b/lab3-bundle.tar.gz differ diff --git a/lab3_data.tsv b/lab3_data.tsv new file mode 100644 index 00000000..6f2f3992 --- /dev/null +++ b/lab3_data.tsv @@ -0,0 +1,102 @@ +practice [main]$ cat 03-cleaning/mock_data.tsv +id first_name last_name email ip_address dob +1 Evelyn Brockhurst ebrockhurst0@bing.com 40.101.189.143 04/02/1987 +2 Carmelina Euler ceuler1@washington.edu 82.222.180.187 10/17/1980 +3 Collin Pealing cpealing2@gnu.org 199.153.193.195 03/24/1985 +4 Jaquenette Nan Carrow jnancarrow3@xinhuanet.com 116.16.126.137 08/25/1980 +5 Malory Bramham mbramham4@g.co 4.255.16.78 11/23/1991 +6 Bald Sheer bsheer5@moonfruit.com 109.203.212.215 08/13/1984 +7 Augy Skippings askippings6@gizmodo.com 15.8.139.132 07/10/1984 +8 Keenan Trebbett ktrebbett7@github.com 119.158.185.199 02/22/1982 +9 Verge Colbourne vcolbourne8@lycos.com 140.130.58.7 09/13/1987 +10 Weider Soans wsoans9@nhs.uk 64.217.202.186 06/28/1998 +11 Codie Scorey cscoreya@ifeng.com 113.13.237.94 10/27/1986 +12 Flori Palatini fpalatinib@dailymail.co.uk 133.188.164.70 06/29/1988 +13 Susana Raven sravenc@rediff.com 93.26.138.131 04/07/1996 +14 Adel Lamswood alamswoodd@noaa.gov 65.72.181.133 09/29/1983 +15 Kit Surcombe ksurcombee@creativecommons.org 200.86.225.239 03/21/1983 +16 Julian St Leger jstlegerf@barnesandnoble.com 20.150.228.198 09/24/1992 +17 Selena Elix selixg@wikispaces.com 49.130.236.99 12/02/1991 +18 Rorke Richichi rrichichih@gov.uk 223.19.109.23 04/13/1996 + +20 Vittoria Dack vdackj@techcrunch.com 52.75.120.100 06/20/1994 +21 Brody Riggott briggottk@berkeley.edu 180.117.7.142 05/23/1997 +22 Glynn Toovey gtooveyl@cnet.com 22.78.230.190 04/25/1986 +23 Drusy Lembcke dlembckem@go.com 50.233.112.213 07/10/1992 +24 Adan Elph aelphn@icio.us 217.74.174.210 02/26/1993 +25 D'arcy Newiss dnewisso@prnewswire.com 67.230.17.235 06/28/1986 +26 Aveline Bridgewood abridgewoodp@ask.com 124.67.167.20 12/17/1994 +27 Neilla Ommanney nommanneyq@about.me 216.228.194.96 11/06/1987 +28 Letty O'Brien lobrienr@sitemeter.com 92.108.176.181 03/23/1998 +29 Laney Mearns lmearnss@unicef.org 80.187.167.67 12/22/1999 +30 Kermie Trevain ktrevaint@desdev.cn 147.39.49.115 02/10/1991 +31 Alice Pleasance apleasanceu@angelfire.com 170.83.241.188 02/02/1999 +32 Ellissa Vockings evockingsv@spiegel.de 82.189.241.229 05/08/1981 +33 Brandyn Tace btacew@miitbeian.gov.cn 177.213.56.112 06/04/1981 +34 Jennica Mussard jmussardx@yolasite.com 248.122.107.88 06/10/1988 +35 Malvin Richfield mrichfieldy@usnews.com 231.162.252.234 09/08/1993 +36 Dorette Matzl dmatzlz@mit.edu 253.233.237.164 09/10/1991 +37 Dannie Rayworth drayworth10@bbb.org 227.215.252.119 06/30/1984 +38 Kristofer Dering kdering11@zimbio.com 200.222.214.216 08/20/1990 +39 Hewe Bozier hbozier12@ehow.com 162.37.14.107 10/18/1991 +40 Hildagard Twomey htwomey13@about.com 249.31.215.101 10/16/1995 +41 Filip Greveson fgreveson14@mit.edu 194.164.255.182 06/26/1998 +42 Harcourt Mounce hmounce15@microsoft.com 112.86.245.144 04/04/1983 +43 Ofilia Brearty obrearty16@bing.com 162.11.119.21 12/01/2000 +44 Barnaby O'Docherty bodocherty17@angelfire.com 141.177.51.203 08/28/1983 +45 Kliment Arbor karbor18@weibo.com 41.172.124.123 08/18/1993 +46 Clara Kantor ckantor19@gmpg.org 166.174.201.185 06/26/1992 +47 Judye Bour jbour1a@examiner.com 243.64.205.174 06/08/1986 +48 Cairistiona Andriolli candriolli1b@scientificamerican.com 134.137.231.40 08/01/1983 +49 Christophe Curror ccurror1c@storify.com 188.108.186.85 06/18/1981 +50 Yankee Lind ylind1d@ocn.ne.jp 229.75.126.48 10/24/1998 +51 Park Boshers pboshers1e@blogtalkradio.com 214.180.127.83 04/21/1995 +52 Zachariah Honisch zhonisch1f@ebay.co.uk 99.231.100.144 07/18/1990 +53 Janice MacNeice jmacneice1g@istockphoto.com 30.254.111.172 07/01/1981 +54 Chaim Creedland ccreedland1h@ibm.com 30.228.94.43 09/07/1994 +55 Isabel Keeves ikeeves1i@cam.ac.uk 54.148.82.180 04/15/1992 +56 Kale Grundle kgrundle1j@reddit.com 177.111.133.24 03/24/1986 +57 Ulick Caldicot ucaldicot1k@blogspot.com 222.82.249.33 04/13/1982 +58 Raye McHan rmchan1l@discuz.net 254.183.160.196 02/07/1995 +59 Clair Bracken cbracken1m@mlb.com 49.227.205.10 04/12/1983 +60 Rebe Killigrew rkilligrew1n@digg.com 111.143.117.213 03/08/1981 +61 Dorene Muscat dmuscat1o@blogger.com 221.135.34.120 02/11/1991 +62 Virgil Simanenko vsimanenko1p@bloomberg.com 15.225.157.64 10/10/1980 +63 Fidole Norkett fnorkett1q@gmpg.org 16.241.104.94 06/23/1981 +64 Annissa Barnfield abarnfield1r@shutterfly.com 197.48.176.149 07/03/1985 + + +67 Jamesy Planque jplanque1u@usgs.gov 80.152.71.117 05/08/1997 +68 Damiano Benardeau dbenardeau1v@japanpost.jp 237.225.77.130 06/30/1985 +69 Cherri McDougald cmcdougald1w@toplist.cz 174.10.130.106 05/24/1990 +70 Alick Tzarkov atzarkov1x@nationalgeographic.com 111.161.176.87 09/11/1983 +71 Milly Wessing mwessing1y@hostgator.com 87.210.64.18 02/07/2000 +72 Elinor Orwell eorwell1z@ibm.com 78.202.193.7 02/16/1995 +73 Seana Sommerville ssommerville20@tiny.cc 90.66.11.112 04/09/1983 +74 Drusilla Friedenbach dfriedenbach21@walmart.com 249.112.143.190 10/30/1995 +75 Saw Sonnenschein ssonnenschein22@wisc.edu 158.152.13.68 08/05/1982 +76 Chelsy Hughlin chughlin23@printfriendly.com 78.172.147.158 11/30/2000 +77 Talia Almack talmack24@sourceforge.net 87.197.17.215 04/17/1990 +78 Lotte Dewdeny ldewdeny25@dropbox.com 89.39.25.234 03/07/1987 +79 Alonzo St Ledger astledger26@so-net.ne.jp 18.38.99.31 01/12/1993 +80 Willa Hardaway whardaway27@harvard.edu 205.112.253.142 11/17/1985 +81 Sibeal Bowld sbowld28@facebook.com 67.149.175.113 10/08/1990 +82 Sondra Issacoff sissacoff29@webs.com 114.179.25.96 08/14/1995 +83 Silvano Juschke sjuschke2a@homestead.com 240.165.154.75 07/30/1998 +84 Cole Kindle ckindle2b@dot.gov 240.254.220.145 04/01/1991 +85 Doe Whines dwhines2c@adobe.com 121.175.83.74 08/13/1988 +86 Travus Kneath tkneath2d@sbwire.com 238.162.86.215 11/24/1994 + +88 Basil St. Ledger bstledger2f@imgur.com 196.72.84.51 04/10/1997 +89 Janeczka Skipperbottom jskipperbottom2g@state.tx.us 71.11.240.157 04/15/1997 +90 Robenia Verma rverma2h@cnn.com 220.86.10.16 05/21/1993 +91 Stafani McCart smccart2i@google.com.au 176.23.39.157 04/05/1994 +92 Danyette Mirfin dmirfin2j@ihg.com 236.106.32.75 04/05/1999 +93 Heddi Boddam hboddam2k@shinystat.com 88.15.204.74 07/08/1985 +94 Sheelagh Karlmann skarlmann2l@weebly.com 171.193.253.225 04/30/1994 +95 Lela Willows lwillows2m@usgs.gov 165.134.215.107 04/15/1980 +96 Celene Alyutin calyutin2n@time.com 1.97.67.151 05/13/1996 +97 Ursa Werendell uwerendell2o@infoseek.co.jp 166.82.77.63 07/05/1987 +98 Anny Jekyll ajekyll2p@skype.com 234.231.87.6 11/10/1980 +99 Cyrillus Happel chappel2q@imageshack.us 224.103.26.159 04/21/1989 +100 Eulalie Glynne eglynne2r@desdev.cn 190.180.105.45 07/06/1998 diff --git a/madlib.sh b/madlib.sh new file mode 100755 index 00000000..bb4bd641 --- /dev/null +++ b/madlib.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +clear +echo "Let's build a mad-lib!" + + + +read -p "1. Name an unusual sport: " NOUN1 +read -p "2. Give me a silly verb: " VERB1 +read -p "3. Name a famouse person: " NOUN2 +read -p "4. Give me an adjective: " ADJ1 +read -p "5. Name a place: " NOUN3 +read -p "6. Name a mode of travel: " NOUN4 +read -p "7. Give me an adverb (ending in -ly): " ADVERB1 +read -p "8. Name a plural noun of a group of people: " NOUN5 + +clear + +echo "-----------------------------------------------------------------------------------------------------" + +echo "My best friend peter loves to play a sport called $NOUN1. One day, he came across one of the +best players in the sport, $NOUN2. Peter was able to talk to him and they ended up hitting it off. $NO$ +so facinated by Peter and his story that he invited him to go $VERB1 this upcomming weekend. And so th$ +Peter travel through $NOUN4 to $NOUN2 's house which is located just outside $NOUN3. The day went $ADV$ +midnight peter as he was entering back into his home was surprized by $NOUN5 who all sang happy birthd$ +is the best week ever" said Peter. And so Peter $VERB1 all night and lived happly ever after. THE END + +echo "-----------------------------------------------------------------------------------------------------" diff --git a/my-work/babymemegif b/my-work/babymemegif new file mode 100644 index 00000000..53b4438b Binary files /dev/null and b/my-work/babymemegif differ diff --git a/my-work/jackjohnson b/my-work/jackjohnson new file mode 100644 index 00000000..0a27297c Binary files /dev/null and b/my-work/jackjohnson differ diff --git a/my-work/lab3/convert-bundle.sh b/my-work/lab3/convert-bundle.sh new file mode 100755 index 00000000..5d9c2290 --- /dev/null +++ b/my-work/lab3/convert-bundle.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +curl -O https://s3.amazonaws.com/ds2002-resources/labs/lab3-bundle.tar.gz + + +tar -xzf lab3-bundle.tar.gz + + +awk '!/^[[:space:]]*$/' myfile.tsv > cleaned_file.tsv + + +tr '\t' ',' < cleaned_file.tsv > myfile.csv + + +line_count=$(tail -n +2 myfile.csv | wc -l) +echo "Number of rows of data is: $line_count" + +tar -czf converted-archive.tar.gz myfile.csv + + diff --git a/my-work/lab3/github-events.py b/my-work/lab3/github-events.py new file mode 100755 index 00000000..ad869374 --- /dev/null +++ b/my-work/lab3/github-events.py @@ -0,0 +1,17 @@ +#!/bin/python3 + +import os +import json +import requests + +GHUSER = os.getenv('GITHUB_USER') + +url = 'https://api.github.com/users/{0}/events'.format(GHUSER) + +r = json.loads(requests.get(url).text) + +for x in r[:5]: + event = x['type'] + ' :: ' + x['repo']['name'] + print(event) + +print(r) diff --git a/my-work/lab3/madlib.sh b/my-work/lab3/madlib.sh new file mode 100755 index 00000000..bb4bd641 --- /dev/null +++ b/my-work/lab3/madlib.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +clear +echo "Let's build a mad-lib!" + + + +read -p "1. Name an unusual sport: " NOUN1 +read -p "2. Give me a silly verb: " VERB1 +read -p "3. Name a famouse person: " NOUN2 +read -p "4. Give me an adjective: " ADJ1 +read -p "5. Name a place: " NOUN3 +read -p "6. Name a mode of travel: " NOUN4 +read -p "7. Give me an adverb (ending in -ly): " ADVERB1 +read -p "8. Name a plural noun of a group of people: " NOUN5 + +clear + +echo "-----------------------------------------------------------------------------------------------------" + +echo "My best friend peter loves to play a sport called $NOUN1. One day, he came across one of the +best players in the sport, $NOUN2. Peter was able to talk to him and they ended up hitting it off. $NO$ +so facinated by Peter and his story that he invited him to go $VERB1 this upcomming weekend. And so th$ +Peter travel through $NOUN4 to $NOUN2 's house which is located just outside $NOUN3. The day went $ADV$ +midnight peter as he was entering back into his home was surprized by $NOUN5 who all sang happy birthd$ +is the best week ever" said Peter. And so Peter $VERB1 all night and lived happly ever after. THE END + +echo "-----------------------------------------------------------------------------------------------------" diff --git a/my-work/lab4bashscript b/my-work/lab4bashscript new file mode 100644 index 00000000..88ab0c6f --- /dev/null +++ b/my-work/lab4bashscript @@ -0,0 +1,13 @@ +#!/bin/bash + +BUCKET_NAME="ds2022-epj7rf" + +FILE_PATH="jackjohnson" + +EXPIRE_TIME=604800 + +aws s3 cp "$FILE_PATH" s3://"$BUCKET_NAME"/ + +PRESIGNED_URL=$(aws s3 presign --expires-in $EXPIRE_TIME s3://"$BUCKET_NAME"/"$FILE_PATH") + +echo "Presigned URL: $PRESIGNED_URL" diff --git a/my-work/lab4pythonscript b/my-work/lab4pythonscript new file mode 100644 index 00000000..58843adf --- /dev/null +++ b/my-work/lab4pythonscript @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +import boto3 + +#I got help from ChatGPT for this script, I got a little lost in trying to solve this + + +bucket_name = 'ds2022-epj7rf' +file_path = 'jackjohnson' +expires_in = 604800 + +s3 = boto3.client('s3') + +s3.upload_file(file_path, bucket_name, file_path) + +presigned_url = s3.generate_presigned_url( + 'get_object', + Params={'Bucket': bucket_name, 'Key': file_path}, + ExpiresIn=expires_in +) + +print(f'Presigned URL: {presigned_url}') + + diff --git a/myfile.csv b/myfile.csv new file mode 100644 index 00000000..e69de29b