This file contains 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 php-xml php-mbstring php8.1-imagick | |
3. Install MySQL server |
This file contains 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 validate_input(gross): | |
try: | |
return int(gross) | |
except ValueError as e: | |
print("Incorrect gross input. Please provide gross value as int or float.") | |
gross = input('provide gross input') | |
gross = validate_input(gross) |
This file contains 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
from functools import reduce | |
def inifix_operator(expression, variables=None): | |
opr = set(['/','+','-','*']) | |
ex = expression.strip().split() | |
num_count = len(opr.difference(ex)) | |
num_opr = len(opr.intersection(ex)) | |
valid = num_count - num_opr |
This file contains 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
lgb_params = { | |
'feature_fraction': 0.75, | |
'metric': 'rmse', | |
'nthread':1, | |
'min_data_in_leaf': 2**7, | |
'bagging_fraction': 0.75, | |
'learning_rate': 0.03, | |
'objective': 'mse', | |
'bagging_seed': 2**7, | |
'num_leaves': 2**7, |
This file contains 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
class Employee(object): | |
"""Models real-life employees!""" | |
def __init__(self, employee_name): | |
self.employee_name = employee_name | |
def calculate_wage(self, hours): | |
self.hours = hours | |
return hours * 20.00 | |
# Add your code below! |
This file contains 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
check1 <- data.table(name = c('a,b','a,b,c','a,b,d','b,d,e','e,f,g','a,b,f')) | |
to_columns <- function(df, col_name) | |
{ | |
get_values <- unique(unlist(strsplit(df[[col_name]], split = ","))) | |
d <- strsplit(df[[col_name]], split = ",") | |
for(i in get_values) | |
{ | |
df[[paste0("col_",i)]] <- sapply(d, function(x) as.integer(i %in% x)) |
This file contains 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
# Enter your code here. Read input from STDIN. Print output to STDOUT | |
con <- file('stdin','r') | |
input <- readLines(con) | |
n1 <- input[[1]] | |
n2 <- input[[2]] | |
n1 <- as.numeric(unlist(strsplit(n1, ' '))) | |
n2 <- as.numeric(unlist(strsplit(n2, ' '))) |
This file contains 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
### Median and Quartile | |
cal_med <- function(x) | |
{ | |
### median | |
x<- sort(x) | |
l1 <- length(x) | |
mid <- c() | |
if(l1 %% 2 == 0) mid <- append(mid, c(l1/2, (l1/2)+1)) | |
else mid <- append(mid, ceiling(l1/2)) |
This file contains 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
con = file('stdin', open='r') | |
inputs <- readLines(con) | |
n <- inputs[[1]] | |
n1 <- inputs[[2]] | |
n1 <- unlist(strsplit(n1, ' ')) | |
n1 <- as.integer(as.factor(n1)) | |
n1 <- n1[length(n1):1] | |
cat(n1) |
This file contains 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
ssh -i he-standalone.pem ubuntu@10.1.136.21 |
NewerOlder