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
library(data.table) | |
library(jsonlite) | |
library(purrr) | |
library(RecordLinkage) | |
library(stringr) | |
library(tm) | |
traind <- fromJSON("train.json") | |
test <- fromJSON("test.json") |
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
damn <- function(x) ## x should be a vector | |
{ | |
p <- list() | |
for(j in x) | |
{ | |
out <- tryCatch({ | |
if(j %% 2 == 0) p <- append(p, j) | |
else p <- append(p, 101) |
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
strn = 'abcbaabbcc' | |
d = {} | |
k = 2 | |
prev_word = strn[0] | |
c = 1 | |
for s in strn[1:]: | |
if prev_word == s: | |
c+=1 | |
print('this is c = {} in first loop'.format(c)) |
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
### 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)) |
NewerOlder