This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YouTube video link: https://youtu.be/8Uofkq718n8 | |
| All the commands that are executed in the above youtube video are mentioned in this gist. | |
| 1. Install Apache server on Ubuntu | |
| sudo apt install apache2 | |
| 2. Install php runtime and php mysql connector | |
| sudo apt install php libapache2-mod-php php-mysql | |
| 3. Install MySQL server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pipeline(*funcs): | |
| def helper(arg): | |
| result = arg | |
| for func in funcs: | |
| result = func(result) | |
| return result | |
| return helper | |
| fun = pipeline(lambda x: x * 3, lambda x: x + 1, lambda x: x / 2) | |
| print(fun(3)) #should print 5.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def unique_names(names1, names2): | |
| names1_s = set(names1) | |
| names2_s = set(names2) | |
| return list(names1_s.union(names2_s)) | |
| names1 = ["Ava", "Emma", "Olivia"] | |
| names2 = ["Olivia", "Sophia", "Emma"] | |
| print(unique_names(names1, names2)) # should print Ava, Emma, Olivia, Sophia |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT name | |
| FROM employees | |
| WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT NULL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT userId, avg(duration) | |
| FROM sessions | |
| GROUP BY userId | |
| HAVING COUNT (userId) > 1; |