Skip to content

Instantly share code, notes, and snippets.

View thanoojgithub's full-sized avatar
🏠
Working from home

thanooj kalathuru thanoojgithub

🏠
Working from home
View GitHub Profile
Spring Boot Notes
@Component vs @Bean
The @Bean annotation is a method-level annotation, whereas @Component is a class-level annotation.
The @Component annotation doesn't need to be used with the @Configuration annotation, whereas the @Bean generic annotation has to be used within a class annotated with @Configuration.
If your component doesn't need to communicate with a database or return an HTTP result, you can use the @Service annotation whenever using the @Component annotation is possible.
@thanoojgithub
thanoojgithub / MySQL installation in WSL2 ubuntu
Created April 22, 2022 09:50
MySQL installation in WSL2 ubuntu
MySQL installation in ubuntu
sudo apt update
sudo apt upgrade
sudo apt install mysql-server
sudo apt install mysql-client
mysql --version
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start
sudo service mysql status
@thanoojgithub
thanoojgithub / Install_redis-server_on_ubuntu
Last active April 21, 2022 13:06
Install redis server on ubuntu
thanooj@thanoojWin10Home:~$ sudo apt update
thanooj@thanoojWin10Home:~$ sudo apt upgrade
thanooj@thanoojWin10Home:~$ sudo apt autoremove
thanooj@thanoojWin10Home:~$ sudo apt install redis-server
sudo service redis-server start
or
@thanoojgithub
thanoojgithub / Hadoop3.2.2_Start-up_commands.txt
Last active March 21, 2022 05:14
Hadoop 3.2.2 Start-up commands
Hadoop 3.2.2
Start-up commands:
--------------------------------
1. Stop the dfs and yarn first.
2. Remove the datanode and namenode directories as specified in the core-site.xml file.
3. Re-create the directories.
4. hdfs namenode -format
5. Then re-start the dfs and the yarn as follows.
start-dfs.sh
start-yarn.sh
@thanoojgithub
thanoojgithub / MySQLShell8.0.28Sample.sql
Created March 18, 2022 02:28
MySQL Shell 8.0.28 sample
MySQL Shell 8.0.28
Copyright (c) 2016, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
MySQL JS > \connect thanooj@localhost
Creating a session to 'thanooj@localhost'
Please provide the password for 'thanooj@localhost': ********
@thanoojgithub
thanoojgithub / create_empty_parquet_file_from_existing_parquet_file.py
Last active March 27, 2022 17:22
create empty parquet file from existing parquet file
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
from pyspark.sql.types import StructType, StructField, StringType, TimestampType
if __name__ == "__main__":
spark = SparkSession \
.builder \
.master('local') \
.appName('pyspark-test-run') \
@thanoojgithub
thanoojgithub / 2_SCD_Type_2_Data_model_using_PySpark.py
Last active March 27, 2022 16:44
Sample code 2 - Implementing SCD Type 2 Data model using PySpark
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
spark = SparkSession \
.builder \
.master('local') \
.appName('pyspark-test-run') \
.getOrCreate()
spark.sparkContext.setLogLevel("ERROR")
@thanoojgithub
thanoojgithub / Sample_code_1_SCD_Type_2_Data_model_using_PySpark.py
Last active January 31, 2022 08:59
Sample code - Implementing SCD Type 2 Data model using PySpark
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
spark = SparkSession \
.builder \
.master('local') \
.appName('pyspark-test-run') \
.getOrCreate()
spark.sparkContext.setLogLevel("ERROR")
@thanoojgithub
thanoojgithub / PySparkOne.py
Last active January 21, 2022 05:01
PySpark Example One
from pyspark.sql import SparkSession
from pyspark.sql import Window
from pyspark.sql.functions import *
spark = SparkSession \
.builder \
.master('local') \
.appName('pyspark-test-run') \
.getOrCreate()
@thanoojgithub
thanoojgithub / JavaByExamples
Last active February 24, 2021 16:19
Java By Examples
1. How to find out second hightest value from a Map<String, Integer>
Map<String, Integer> books = new HashMap<>();
books.put("one", 1);
books.put("two", 22);
books.put("three", 333);
books.put("four", 4444);
books.put("five", 55555);
books.put("six", 666666);
Stream<Integer> list = books.entrySet().stream().filter(e -> e.getValue().toString().length() > 3)
.map(Map.Entry::getValue);