Monday, 27 May 2024

Shell Scripting

 What is Shell?

Shell allows a user to interact with kernel and provide an environment to execute commands.

Types of Shell

  • bash
  • sh
  • ksh
  • tsh
  • fish
  • zsh
How to check your default shell?

poyadav@fedora:~$ echo $0
bash

What is shell scripting?
We can use shell scripting to automate tasks, it contains a set of commands to perform a task which are executed sequencially.

What is shebang?
#!/bin/bash 
It tell our system to use bash for executing the script.

How to execute as bash script?
  • ./file.sh    #Make sure file has execute command (chmod +x file.sh)
  • /path/file.sh  #Make sure file has execute command
  • bash file.sh
Variables
var=hello
var=$(command)
readonly var=value

Arrays
myarray=(1 2 3 "hello" "hii")   #contains space seperated values
echo "${myarray[2]}   #getting 3rd value
echo "${myarray[*]}   #gatiing all values
echo "${myarray[*]:2} #getting specific values

array+=(bye tata)  #adding new values

Key-Value arrays
declare -A myarray
myarray=( [name]=Henry [age]=23 ) 
echo "${myarray[name]}"

Strings Operations
myvar="Hello, how are you?"
length=${#myvar}
upper=${myvar^^}
lower=${myvar,,}
replace=${myvar/Hello/Hey}
slice=${myvar:2:5}

Getting input from user
echo -n "What is your name? "
read name
echo "Your name is $name"

read -p "What is your age? " age
echo "Your age is $age"

Arithmetic Operations
let a++
let a=6*10

((a++))
((a=6*10))


if-else 
if [ condition ];then
echo "PASS"
else
echo "FAIL"
fi

case
echo "where you want to go"
echo "a=Paris"
echo "b=London"
echo "c=USA"

read choice

case $choice in
a) echo "Going to Paris";;
b) echo "Going to London";;
c) echo "Going to USA";;
*) echo "Not going anywhere"
esac

Logical Operators
#Both conditions need to be true/met
if [[ condition1 ]] && [[ condition2 ]];then
echo "PASS"
else
echo "FAIL"
fi

#only one condition need to be true
if [[ condition1 ]] || [[ condition2 ]];then
echo "PASS"
else
echo "FAIL"

for Loop
for i in 1 2 3 4 5
do
echo i
done
#or we can also use
for i in Apple banana grapes
for i in {1..10}

#for loop with file
file=array.sh
for i in $(cat $file);do
echo $i
done

#or we can also use
for ((i=0;i<10;i++))
do
echo "Hello $i"
done

while Loop

#syntaX
count=0
num=10

while [ $count -lt $num ];do
echo "value is $count"
(( count++ ))
done

#reading from file
while read myvar;do
echo $myvar
done < myfile

#while with csv file
while IFS="," read id name age
do
echo "id is $id"
echo "name i $name"
echo "age is $age"
done < file.csv

Infinite Loop

while true;do
echo "Hey"
done
#for infinite loop
for (( ;; ));do
echo "Hey'
done

Functions

fun() {
echo "hello"
}
#another way
function myfun {
echo "Hey"
}

#function with args
myarg() {
echo "Hello $1"
echo "Welcome to $2"
}

fun
myfun
myarg raju manali
























Wednesday, 9 August 2023

SSH (Secure Shell)

 What is ssh?

SSH is a network protocol by which two machines can communicate with each other, we can transfer information or data from client and server in a secure way.

It uses encryption to secure the data that travel over the network to secure it.


Use of ssh:

We can access a remote machine using ssh over the same network.

Command: ssh <user>@<ip>  eg: ssh root@10.65.34.20

Now there are two types of authentication methods that we can use :

  1. Password-based authentication
  2. Key-based authentication
  • In Password-based authentication, we need the password of the host to access it.
  • In key-based authentication, we need keys on the machines ie private and public keys.

How to generate keys.

Command: ssh-keygen 

It generates two keys private key(id_rsa) and public key(id_rsa.pub) at ~/.ssh/

  • Private is private to our local machine, this should never be shared with others.
  • Public key can be shared with other servers/machines. We can copy our public key to a host/server using ssh-copy-id <user>@<ip> or if we can access the UI of the server, we can even upload it there as in GitLab, GitHub. 
The public keys are copied at  ~/.ssh/authorized_host on the server side. When we have our public key shared with the server, we don't need the password to access it, it will be passwordless login from the client. Authentication will be done on the key pair which we added earlier. 

 




Tuesday, 27 August 2019

Flock-2019


Flock is the Fedora Project's annual contributor-focused conference. I attended Flock-2019 which was in Budapest this time. I feel great to be a part of this conference and community. It was four day conference with lots of interesting sessions.


Day 1
First day started with "The State of Fedora" session by Matthew Miller where he discussed about Fedora current and future state. Then Cate Huston presented a very interesting talk on how we can make a great and successful team. She shared interesting facts to make failing team functional. It was good to see "Facebook Loves Fedora" and Facebook employees are using it. In this they shared their experience and challenges faced. After lunch I attended "The future of langpacks in Fedora", it was a great discussion on langpacks. In evening I attended Fedora CI by David and  Tim Flink and Getting started with Fedora QA by Suprith Gangawar and Geoffrey Marr. Day 1 ended with Slideshow Karaoke organised by Amita and Adam Samalik.

                                 

Day 2
On second day, I attended the talk by Denise Dumas on "Fedora, Red Hat and IBM. Then I mostly attended the talks around Fedora CI and gating. Also attended session on "Use cases for Transtats in the Fedora Community". It was a day well spent with so much information on Continuous Integration. Then in the evening we enjoyed the River Cruise with Dinner.


Day 3
Third day started with the showcasing of Fedora Summer Coding 2019 projects where Summer Coding interns talked about their  projects, learning and experiences. Same day we have our Fedora internationalization hack fest where we discussed about how we can increase CI for Fedora i18n packages and did some brainstorming for future release. It was very helpful for me as I got ideas about the high priority packages and how we can contribute more to CI.


Also, I was a part of Fedora Diversity and Inclusion Hack fest which was just after i18n hack fest, so after that I quickly moved to D&I hack fest room where we worked and discussed on some pending tickets and took the action items from those. Also planned for the future elections for next Diversity Advisor. Then in the end there was a walking tour planned around Budapest where we visited some tourist attraction points and learnt some facts about the history of Budapest.


Day 4
On Day 4, I attended the Wrap-Up session and collaborated with people and had some good discussions. This was the last day, most of us were already leaving so there were good byes, future planning etc.

Overall, it was a great experience, as being a part of community it felt good to be meet people and talk to them. It was good to see so many talks about CI and gating and I attended most of them, as I myself is starting to contribute to CI and gating, so these sessions were very helpful and informative.

Below are few pics clicked while different activities in Flock :)


                                 



Friday, 21 June 2019

Fedora Pune Meetup


Last Saturday(June,15) , we had Fedora Pune Meetup with Fedora-30 release celebration. When I reached the venue, people were already present there and were ready to start the event. We started according to the agenda with our first talk from Pravin Satpute on Fedora-30 features which was great, as people were really interested in knowing the new features added.



After that Parag delivered a talk on Modularity. He covered the basics and also covered some examples to make the concept more clear. We had had good discussions around this topic as question were coming in between from the audience. After such a technical discussion a break was really needed. So we went for a short break to grab some snacks.




Then, there was a talk on Fedora CoreOS by Praveen Kumar after the break with a disclaimer that he is only the presenter, slides are prepared by Sinny Kumari. It was a great session with demo and a lot of interactions among attendees. After his session Kushal quickly discussed about QubeOS which was new to me and also interesting. Then we ended the event with Cake cutting to celebrate the release of Fedora-30.

Monday, 8 October 2018

Fedora Women's Day- Pune,2018



On 30th September, we celebrated Fedora Women's day in RIT, Islampur, Dist. Sangli, Maharashtra, India. We (Amita, Nikhil and me) started early in the morning from Red Hat office and reached college at 12.30pm where we met the faculty(Savita Patil, Gautami Singhan) who were already waiting for us. As it was a long journey we just took a quick refreshing break and had lunch after that where we had conversation with the faculty members about various topics like how they have changed their syllabus, initiatives taken to introduce students to Open Source world and about Fedora Women Day. After lunch we headed to the room where we were going to organize the event.

Students were already there, and it was good to see around 30 girls student in the room, as it was Fedora Women Day so we were happy to see them. The event started with a short speech by Mrs Savita Patil who introduced us to the students.


Amita took the first session explaining what Fedora Women Day is and why we need more women in technology. She quoted very interesting examples of women who were doing great job in various field and explained about different fields in which they can contribute. It was really motivating, I am sure after this session many students must have made up their mind and decided the field based on their interest where they want to contribute.


After Amita, I took a session on Fedora QA, where I explained why QA is needed, what's the role and responsibilities of Fedora QA and how they can start with Fedora QA by explaining about Test Day, Bug Triage, Test cases and various other QA activities. As they were new to Fedora, I showed then how they can create FAS and Bugzilla account. I also covered about Fedora Badges in my talk and how they can be earned. By now they were more excited and want to earn those badges. I ended by giving some examples how they can start contributing in different fields.


Then Nikhil took a session on Fedora loves Python where he introduced the students to python. He talked about different libraries. Also he made the talk more interesting by showing some lives examples with demo. It was really great to do some exciting stuff using python.


After the talks it was the time for cake cutting. We all cut the cake and enjoyed the moment. We also get some queries from the student which we answered while having cake. Then Amita thanked the organizers and faculty for hosting this event and supporting us.

Around 4.30 we headed back to Pune. It was a great experience as I get to interact with the students and helped then to get started with Fedora. It was fun travelling with Amita and Nikhil, discussing various interesting things and our stories.


Looking forward for next year Fedora Women's Day to get more women contributor.

Wednesday, 12 September 2018

Flock- 2018

I attended Flock this year which is the Fedora Project's annual contributor-focused conference. This was my first Flock and it turned out be one of the best conferences I have attended so far.


It was a total 4 day event, where I got a chance to learn more about fedora, how things are changing in fedora and meet people face to face. There were many exciting things in Flock besides talks like hack fest, workshop and many activities like Yoga, Candy swap, Scavenger Hunt which made it more interesting.

Day-1:


The day started with the morning Yoga. Then the first keynote on "State of Fedora" where Fedora Project leaders talked about their objectives and editions. It was really helpful in understanding what are the new changes and how they are going to effect the community. There were lot of interesting talks from which I selected few, which were "RHEL,Fedora and CentOS: Solving the Pentose Triangle" by Josh Boyer and Brendan Conoboy. After this I attended a talk on "Desktop testing using dogtail and behave" by Petr Schindler  as I want to know more about desktop testing and the framework he was using for this. After the talk we also had a great discussion about the framework, it was really great to know more about desktop testing.


After this there was Candy Swap event which was organised by Justin Flory, where people from different country bought candies , I also took some Indian candies and sweets to share with others.was a great event, got to taste lot of candies from various regions .


Day-2: 

It started with keynote: "The Power of One:For the good of community" by Rebecca Fernandez which was really motivating as she talked about how we can bring change to the community which are good for others and how we can make a change in the community which we are wishing for. Then I attended a workshop on "Imposter Syndrome and Unconscious Bias Training" by Jona Azizaj, Justin Flory, Bee Padalkar, Amita Sharma as I want to understand how this can be identified and how we can overcome this. This was a interactive workshop where we identified are we suffering from this Syndrome or not and how we can manage it in our life and workplace.

 Then I attended talk on "Fedora CI:Process, Progress and Infrastructure" by bstinson as I have strated contributing to CI and want to know more about the process. After this I attended a talk on "Scalable Fedora Design" by Abhishek Sharma where he shared his knowledge on design system and how Fedora can embraces a design system to ensure consistency and manage design debt.


The day ended with Scavenger Hunt which was organised in the Downtown(Dresden) where we got to know about some interesting facts and history of Dresden. It was really fun going around the city and completing the tasks given. Thanks to the organizers Dominika Bula,Brian Exelbierd , Jennifer Madriaga. I really enjoyed acting a scene from a movie where we in-acted a scene from a bollywood movie "Sholey".

Day-3:

We had hackfect on "i18n development and testing" postlunch. In morning I had a discussion with Lukas about OpenQA as I need to discuss some issues. He told me about how they are using it and his framework which he build to create needles. It was really great to know we can create needles and use them for OpenQA without using OpenQA needles editor with this framework. As I am using OpenQA for automation so it was a great help. We had great discussion about OpenQA which cleared many doubts of mine.
Post lunch we had our hack-fest, where we discussed about the following topics:

  • Upstream First Testing
  • Automation
  • New Features(Langpacks, Fonts etc)
It was great to have this hack fest, as now we were clear on many things and know how we can proceed further with Upstream First and CI initiative. 



After this we went for Dinner at Roller Coaster Restaurant where everything came rolling to us, it was fun :P. There also I had discussion with lot of people. I met a guy from opensuse with whom I talked about OpenQA, also had some healthy conversation with Dodji about exercise, diet and health. It was a great evening spent well with great people.

Day-4:

On the last day most of my time I spent socializing with different people from different domains. I also attended lightening talk to gather more knowledge in less time. All the lightening talks were awesome. After this we had group photo followed by Wrap up Session.

The conference was really good, as I got to know people who can be bugged for specific issues and with whom I can discuss various issues. I also really enjoyed the various events at flock and stayed fit by attending the morning Yoga session . Thanks Suzanne Yeghiayan for taking these session.

Next day, we(Pravin, Sinny, Mike, Praveen, Sayan) went to Saxon Switzerland for a trek, it was great trek with you guys. Thanks Mike for taking us to such a beautiful place.


Thanks everyone for making this a awesome conference.



Monday, 20 August 2018

DevConf.in Event Report


On 4th and 5th August I attended DevConf,in in Bengaluru as a speaker, which was a conference organised by RedHat to provide a platform to all local community participants to come together and share knowledge through technical talks, workshop, panel discussions, hackathon and other activities.

I arrived at Bangaluru airport on 3rd August early morning to avoid the terrific traffic and reached o hotel without facing much traffic. After reaching office I did my office work for that day.
In evening after having dinner, I did the registration in the hotel itself as registration was organised in hotel itself for speakers to save time n morning. It was really helpful, thanks Rahul and Ganesh for handling this process smoothly.

Day-1 (03-08-2018)
I had breakfast early morning ,then we all(speakers) left for the venue- Christ University. The event started with a traditional dance prepared by the students of Christ University which was really great. After that there was a keynote by Ric Wheeler on "Open source is better for companies/businesses, communities and developers" where he talked about evolution open source software from history to present day.


After attending the keynote I went for the QE track talks. QE track started with the talk by Anisha Narang on "Protactor 101s: Quick and Easy" where she introduced the audience to Protactor  an end to end testing framework for Angular/AngularJS/ application.

Then it was the time for my talk in which I talked about "Robot Framework "which is an automation framework where i covered the basics to get the audience started with the framework supported by a short demo. It was really great to get so many questions and know people were really interested in knowing more about the framework. After my talk there was a short tea break, in which I went around the different booths to gain knowledge about the technology and products.

After this I attended talk by Anandprakash on "Best Strategies to test cloud and containers" where he discussed about the strategies which to should be followed based on the scenarios. Then in the same track Rohit talked about "QE to Full Stack Devops QE" where he showed how devops tools can be used by QE to enhance productivity. Then there was a lunch break.

After lunch break, I attended the talks in the QE track which were: Pains and Pleasure of Automatic Software testing and End to end testing made easy with Nightwatch. After there was a keynote by Karanbir Singh on "Open Source Won". This was the end was Day1.

Day-2(04-08-2018)
Second day started with the opening keynote from Christian Heimes on Freedom, Security and Responsibility, it was a great session. Then I attended another security talk by Huzaifa Sidhpurwala on "BlueBorne: Beware of Bluetooth".


After attending this talk I talked to people and shared the knowledge with them. I also attended talk on "Empathy maketh an Engineer" by Narendran, "Tricky task of i18n - Libration fonts" by Pravin Satpute where he talked about Liberation fonts different version and plans for Fedora-29. At the end there was a really interesting talk which I attended "Innovating Indian Education System using FOSS" by Bhavna Yadav where she talked about how we can make a difference if OSS is adapted at lowest level in education system. After this I attended the lightening talks, which were great. As the closing keynote was cancelled due to to some emergency. So after this we have a Thank you and Appreciation session where Rupali thanks the organizers, volunteers, Christ University and all the people involved in making this event a success.

This was a great event. Thanks to all the organizers and volunteers for making this event awesome.
Looking forward to next DevConf.in.