mrinalraj

Social and Technical Blogger

gitCoffee

Got a dream contributing to FOSS projects but lacking confidence in git commands. Don't worry this blog is for you: Let's begin learning git with the following FAQ:

  1. What is git init and why it's used?

    git init: Using this command we first initialize a local git repository. The files we will add here will now be tracked by the git. Running git init command is safe it reinitialize if there is an existing one.

  2. What is git clone and how can I clone a project?

    git clone https://github.com/your_username/repo_name: Will clone the remote repository into a newly-created directory.

  3. What's the status in git?

    git status: This command gives the list of files that have not been committed. This includes modified files and newly created files.

  4. What is Staging? How can I add a file to staging?

    Staging is like a checkpoint where only those files are there which is to be committed. Here we do modify any changes before final commit. git add [file-name.txt]: This command adds the file-name.txt to the staging area.

  5. How can I add all files to the staging area?

    git add -A or git add .: Using this command we can add all new and changed files to the staging area.* Note: There are times when unwanted files like file_name.swp also get added and committed to avoid this it's better to add files one by one.*

  6. How to commit a change with a proper message?

    git commit -m "[commit message]" -m is used to allow adding a commit message
    Using this command we can move all the staging area files to commit area in the local repository.

  7. How can I delete a file or folder?

    git rm file-name or git rm -r folder-name The above command are useful when you are deleting a file or deleting multiple files. git rm -r file-name removes the duplicate file-name recursively.

  8. I have created multiple branches. How can I get all my branches?

    git branch: This command lists all the branches created in your local repository. The asterisk denotes the current branch. git branch -a: This will list all the branches in the local as well as a remote repository.

  9. How to create and delete a branch?

    git branch [branch name]: This command will create a new branch.Note this does not checkout the new branch. git branch -d [branch name]: This command will delete the branch. This is the safest way to delete a branch as it prevents deletion if there are any unmerged changes. git branch -D [branch name]: This command will forcefully delete the branch and also deletes the commits associated with the branch. *Note all the above will bring changes in the local repository.

  10. How can I delete a branch in a remote repository?

    git push origin --delete [branch name]: This command will delete a remote branch.

  11. Can I create a new branch and automatically switch to it?

    Yes, you can use git checkout -b [branch name] command to create a branch and switch to that branch automatically.

  12. How to change branch present in a remote repository?

    Well, It depends on the Git version you are using. For modern version of git: git checkout [remotebranch] For older version of git : git checkout [remotebranch] origin/[remotebranch]

  13. What are the ways to see my commits?

    • git log: Using this we will see all the changes committed in the repositories.

    • git log --summary: Using this we get the detailed view of the changes made in the repositories.

    • git log --oneline: This command gives the history of the commits in brief.

  14. What are the ways to discard changes made to the file?

    • git checkout -- [file-name.txt]: This command will permanently discard all the changes made in the branch local repository.

    • git stash: This command will remove the changes made in the current branch but saves it for later use. So using git stash pop we can get back the saved changes made in the file of that branch.

First of all kudos for successfully creating `.onion' address. If not, see my previous blog. Tor Browser

Just having a domain is useless if you don't know how to make use of it. So let's begin with the newly created domain. Note the following guidelines are verified on Ubuntu 18.04

Step 1 : First make a directory :-

sudo mkdir /var/www/your_directory_name cd /var/www/your_directory_name/

Step 2 : Create a file name index.html :-

touch index.html

Step 3 : Editing the newly created file

sudo vi index.html : sudo gives the power to override the readonly files Press 'i' to go in INSERT mode Write your good name Press ESC and give :wq as command to save index.html and exit vi Editor.

Step 4 : Editing the root :

cd /etc/nginx/sites-available/ : If says permission denied sudo it :) sudo vi default : It will open long content. Edit the root line from '/var/www/html' to '/var/www/yourdirectoryname'. Save and exit.

Step 5 : Reloading nginx :

systemctl reload nginx

Kudos our work is done

Step 6 : Open your domain name in Tor Browser :

Incase you forgot your domain name. Type sudo cat /var/lib/tor/hidden_service/hostname

Happy Coding :)


Onion Note : The following guidelines are verified on Ubuntu 18.04 First install tor and nginx using the following commands: sudo apt install tor sudo apt install nginx sudo ufw allow Nginx Full

Open Terminal and enter : vi /etc/tor/torrc command press i to go in INSERT mode. then search for ############### This section is just for location-hidden services ###

Un-comment the following 2 lines by removing “#” symbol. HiddenServiceDir /var/lib/tor/hidden_service/ HiddenServicePort 80 127.0.0.1:80

to exit vi press Esc then enter :wq to save the changes and exit.

Try to restart the tor and nginx services by the following two commands: sudo service tor restart sudo systemctl restart nginx

On entering the command : sudo ls /var/lib/tor/hidden_service/ you will find filename such as hostname and private key. Enter : sudo cat /var/lib/tor/hidden_service/hostname use will find .onion address. Check it on the Tor browser.

“Congrats you got your own new domain.”

This post may contain error. Please bring it to the notice to help others. By connecting Mrinal Raj


First things first, we should be thankful that we all live in a country where there is freedom to speak on our views. As decades passed and technology evolved the ways of expressing our views have changed completely. We spend most of the time on various social networking sites, updating status almost regularly, sharing our locations, our likes and dislike, our religion and even our views on politics. Now the question is what if we are being tracked? What if these data are easily available to the trackers. You are then left with two replies :

  • Either you completely deny the fact that it is possible.
  • Or you say you got nothing to hide and got no problem with it!

You will find most of the people who state that they have nothing secret in them to hide, it sounds like you don't care about your fundamental rights as you have got nothing special to speak.

To say that you have nothing to hide means like you have nothing to say to protect your freedom of speech.

-Edward Snowden

If you think your privacy is safe and no one is peeping inside your personal and professional life, you need to go through inspiring true story of Edward Snowden and how he was chased when he chose the path of adversaries to benefit others instead of spending rest of his life luxuriously.

Edward Snowden


Edward Joseph Snowden was working as a contractor under US Government where he had access to all the classified files collected from the global surveillance. Edward revealed in public misuse of around billions of internet data and telephonic data records which is called metadata collected by government globally without user's interest. Edward saw that this was a direct attack on the citizens' Freedom of Speech and privacy.

Government's Point of View


Right after the 9/11 attack on the World Trade Centre, US government took various steps to curb terrorism among which one was to give secret access to US State Secret Service which can conduct the surveillance on any of citizen's phone record, GPS location, browser history, etc. Through MNC's like Google, Facebook, Apple they started to gain the data on the citizens. According to the report, there have been about 1.2 million people under the US watch list. Government believes that they can prevent terror attack before it happens using mass surveillance at the stake of our Right to privacy.

Conclusion


Most of the time we fall prey to the online trackers like Facebook and Google where our privacy is more vulnerable. We should try to avoiding websites that tracks our identity and location. Always open-source software should be preferred over a proprietary one.


Hello Python fans, if you are looking for building any python projects and at the same time making it interactive. You have to make use of several GUI packages in python. Python supports tkinter and other GUI frameworks like kivi, WxPython you can make several user friendly and interactive interface.

So using fewer lines of code in python you can create a Notepad like interface.


Mrinal's blog

Hello visitor , This is my first blogpost from #dgplug. I write articles and blog related to Tech, algorithms and programming language. Previously I had written from the Wordpress, some of them are :

* The Legacy of Aaron Swartz * Negative Experience and Positive Impact * The Python

Visit and Don't forget to give suggestions there :)