Skip to content

Instantly share code, notes, and snippets.

View arizalsandi's full-sized avatar

arizalsandi

View GitHub Profile
@arizalsandi
arizalsandi / gist:fd42a138280c63ae60c57ff61fac4a75
Created June 2, 2024 00:00 — forked from teja156/gist:8c35a05f43635da4cbd06b47c0d91e93
Commands for deploying wordpress website on AWS EC2 shown in my YouTube video
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
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
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
SELECT name
FROM employees
WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT NULL);
@arizalsandi
arizalsandi / session.sql
Last active June 17, 2021 04:06
session
SELECT userId, avg(duration)
FROM sessions
GROUP BY userId
HAVING COUNT (userId) > 1;