Introduction

Welcome amigo!

I created this wiki just for documenting some of the stuff that I have learnt. I use it as a quick reference to save time and kind of avoid relearning things. This whole wiki is specifically made for myself - so not everything in here is explained in detail and some of the pages may even contain mistakes.

Of course, if you have any questions or spot any mistakes, you are always free to contact me

Git

Push an existing local repository to GitHub

How to push an existing local repository to GitHub

Make sure the default branch name is 'main'.(main is the default branch name in my case.)

  1. Create a new repo on GitHub. The repository should be empty.

  2. Copy the URL of the repo on GitHub

  3. Add the copied URL as remote URL.

    git remote add origin REMOTE-URL

  4. Push the repo

    git push origin main

Useful Git Commands

git stash

  • If you are working on a branch and you need to switch to another branch to work on something else, then git will not allow you to do so if you have uncommittedd changes.
  • In such a situation, git stash can be used to temporarily save uncommitted changes. It reverts your directory to the last committed state.

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.

  • Use git stash pop when you are ready to add the changes back to your code

git commit -am

  • Instead of using git add . then git commit -m "commit message", you can use

    git commit -am "message"

View git remote URL

  • git remote -v to view the remote URLs of a repository.

Useful Stuff for KTU

A collection of playlists, youtube videos and channels and websites that I use for studying.

S1 & S2

For first year, I mostly referred to the prescribed textbooks.

Engineering Mechanics

Engineering Physics

S3

DSA (Data Structures & Algorithms)

LSD (Logic System Design)

OOP (Object Oriented Programming) in Java

  • Head First Java: A Brain-Friendly Guide This is actually a really good book that I found helpful. All the important concepts are explained in simple language with plenty of examples. The book was pretty fun to read.

S5

FLAT (Finite Language and Automata)

Linux

Using tar.gz

I decided to try out the jetbrains applications. This is how I use the tarball.

Once the file is downloaded, you have to extract the file. The application can be launched by executing the ./bin/ WebStorm.sh script.

But it is much easier to launch the application by adding the directory to the PATH

  1. Extract the file

  2. Add directory to PATH

    nano ~/.bashrc

    export PATH=$PATH:/path/to/directory/

  3. Reload the shell environment

    source ~/.bashrc

apt package manager

Search for a package

To search for a package from the command line, use: apt-cache search keyword

Show package details

To show package details, use apt show package-name.

Basics of Vim

I just put this here so I can for future reference. Of course, there are many cheatsheets and guides on how to use vim. This is just my personal cheatsheets. I am not planning on adding every command, only just some useful ones.

If you find any mistakes here, please let me know.

Additional Reference

Start

Vim has basically four modes:

  1. Normal Mode (Command Mode) - the default mode.
  2. Command Line Mode - Play around with commands
  3. Insert Mode - for editing the contents of the file
  4. Visual Mode - for selecting the text.

How to enter each modes?

  • Press Esc to enter normal mode.
  • Press i to enter insert mode.
  • Press v for visual mode.
  • Press : to enter command line mode.

Saving and Quitting

Enter command mode

  • Use :w to save the file
  • Use wq to save and quit
  • Use q! to exit the file without saving changes made to the file
  • Use q if no changes were made.

Cursor Movements

  • h - to move left
  • l - to move right
  • j - move cursor down
  • k- move cursor up
  • G - to move to the last line
  • $ - to move to the end of a line

More commands for insert mode

  • o - insert new line after the current line
  • O - insert line before the current line
  • a - insert after cursor
  • i - insert before cursor
  • A - insert at end of line
  • I - insert at beginning of line

Undo Redo

  • u - Undo
  • Ctrl + R - for redo

Set line numbers or relative line numbers

  • set number - to display line numbers
  • set relativenumber - to display relative line number

Debian Mirrors

The sources file is located at /etc/apt/sources.list. More info on the sources.list file can be found on the Debian Wiki.

Mirrors that I use:

More mirrors can be found on the Free Software Mirrors in India page.

Thinkpad

I use a Lenovo ThinkPad E16 Gen 2 (AMD) with Fedora as my Operating System.

Operating System

  • Fedora 41 Workstation
  • GNOME Desktop

Specifications

  • Processor AMD Ryzen™ 5 7535U Processor (2.90 GHz up to 4.55 GHz)
  • Graphic Card Integrated AMD Radeon™ 660M
  • Memory 16 GB DDR5-4800MHz (SODIMM)
  • Storage 512 GB SSD M.2 2242 PCIe Gen4 TLC Opal
  • Display 40.64cms (16) WUXGA (1920 x 1200)
  • IPS, Anti-Glare, Non-Touch, 45%NTSC, 300 nits, 60Hz
  • Camera 720P HD RGB with Microphone and Privacy Shutter
  • Battery 3 Cell Li-Polymer 47Wh
  • WIFI Realtek 8852BE WIFI 6 2x2ax + BT5.x & Bluetooth® 5.1 or above

More information can be found in the PSREF

Swap Fn and Ctrl Key

On thinkpads for some reason, the function and control keys are in a different position. I have no clue why Lenovo does this.

Anyway, if you prefer, you can swap the keys by using the BIOS. Please refer this article by Lenovo to swap the function and control keys.

Linux Installation

Update System and BIOS

  • Before getting rid of Windows, update the BIOS using Lenovo Vantage software. For more information, visit Lenovo's website

Disable Bitlocker Encryption

Before installing Linux on your ThinkPad, you must check if Bitlocker encryption is enabled on your disk.

If BitLocker encryption is enabled, please disable it before following the below steps.

You must disable bitlocker encryption to install Linux and backup your keys

Secure Boot

What is Secure Boot?

UEFI Secure boot is a verification mechanism for ensuring that code launched by firmware is trusted. More info can be found in the Ubuntu Wiki

Enable Secure Boot

The Bitlocker recovery screen will appear on changing the BIOS settings. Make sure you have bitlocker encrpytion disabled and have a backup key of your recovery key. The screen appeared for me because I hadn't disabled Bitlocker.

Source of Instructions: Lenovo

  1. Reboot your PC
  2. Boot into the BIOS setup menu by pressing the F1 key when the Lenovo logo is displayed
  3. In the BIOS menu select the “Security” option and the “Secure Boot” sub-menu. Toggle the “Allow Microsoft 3rd party UEFI CA” to be “On” as shown below. BIOS of Lenovo
  4. Press F10 to save and reboot

Linux Install

  1. Flash the ISO on to a USB using Rufus, Balena Etcher or the software of your choice (Since I use Fedora, I used Fedora Media Writer)
  2. Take your freshly written USB key and insert it in the powered down installation platform.
  3. Power on the device and press F12 during early boot to enter the Boot Menu.
  4. Navigate down to the USB HDD device and press Enter.
  5. Select the appropriate option from the GRUB Menu (In my case it was Test this media & start Fedora-Workstation-Live.)

CSS

Improving CSS Reset

How you can make your site a little bit more better by using the css below. Source

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

p,
li,
figcaption {
  text-wrap: pretty;
  max-width:65ch;
}
 

Dark Theme

How to add dark theme to a website using only css.

@media (prefers-color-scheme: dark) {
  img {
    opacity: .75;
    transition: opacity .5s ease-in-out;
  }
  img:hover {
    opacity: 1;
  }
}

Source