How To Create A GitHub Profile README

How do I create a profile README?

GitHub recently released a feature that allows users to create a profile-level README to display prominently on their GitHub profile. This article walks you through how to access this new feature.

The profile README is created by creating a new repository that’s the same name as your username. For example, my GitHub username is trickyj so I created a new repository with the name trickyj.

Note: at the time of this writing, in order to access the profile README feature, the letter-casing must match your GitHub username.

Get the source – https://github.com/trickyj/trickyj

Check out by AbhiShekAwesome Github Profile README

Check PowerShell Security Protocol Type

To check whic

List the Security Protocol configuration

[Net.ServicePointManager]::SecurityProtocol

Get the BaseType of Net.SecurityProtocolType

[Net.SecurityProtocolType]

# Get the PowerShell supported TLS versions

[enum]::GetNames([Net.SecurityProtocolType])

# Force PowerShell to use TLS 1.2

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

Force PowerShell to use TLS 1.2

By default, PowerShell uses TLS 1.0. Because SEP (Symantec Endpoint Protection) uses TLS 1.2, you will receive a connection error message if you do not change this behaviour. To force PowerShell to use TLS 1.2, add the following line to your script:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

Check Execution Policy

Read more About Execution Policies
All PowerShell execution policies:
  • Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode.
  • AllSigned – Only scripts that are signed by a trusted publisher can be run.
  • RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
  • Unrestricted – No restrictions; all Windows PowerShell scripts can be run.

The “Get-ExecutionPolicy” cmdlet shows the current PowerShell execution policy.

The “Set-ExecutionPolicy” cmdlet changes the PowerShell execution policy.

Example –

  • By default in my windows 10 client machine. Scope of execution policy was set to Undefined. I used Get-ExecutionPolicy -List command
  • By using Set-ExecutionPolicy -ExecutionPolicy RemoteSigned command and it changed LocalMachine scope to RemoteSigned.

How to Pull Request (PR)

Recently I came across through Facebook’s Open Source Immersion program.

The goal of this initiative is to provide developers with practical education and experience contributing to Open Source projects in preparation for our annual Developer Circles Community Challenge later this year.

Over one month starting July 15, 2020 at 12:00 AM PST, participants in the Open Source Immersion will be asked to submit a minimum of four Pull Requests (PR), where one out of four of these PRs will need to be aimed towards a Facebook-led Open Source project in the Developer Circles Repo.

read more on facebook developers site…

In order to start contributing to open source projects, it is very important to learn how to work with GIT/GitHub. Trust me best way to learn is to start using it.

Let’s get started – In order to submit the Pull Requests (PR’s) we need to first know what is PR and how to work with it in GitHub.


Barnching, Merging, & Pull requests in GitHub.


Agenda –
  • An overview of branches
  • working with branches on GitHub
  • Pull requests and GitHub flow.
An overview of branching in Git
  • Much more lightweight
  • Branching is very fast
  • Encouraged to be used
  • Works because of the way git works.
    • Snapshots

Note – Commits in Git

Every time you commit git will store a pointer to one of its snapshots.

Note – Branching in git –

  • Branch is a pointer to a commit.
  • Default branch is master
    • points to latest commit.
    • Moves forward with every commit.
    • Use branches for.

When to create branches ?

  1. Features – when creating/adding new features.
  2. Bugs – If you want fix bug.
  3. Experiments – If you want to experiment.

Note –

  • When you create new branches, the Master branch is not changed.
  • Once u are happy with the changes in the branches then merge it with a master.

Demo1 : Creating a Branch on GitHub | The Commands for the Branching.


Create New Branch with this command

$ git branch [ barnch name ]

The above command will show you all the branches in your repo.

$ git checkout [ branch name ]

With the above command you can switch from one branch to another, At this point the files in the working directory are replaced with the one’s in that current branch.

$git push -u [ origin ] [ branch ]

When you create new branch, it is not pushed to GitHub automatically. You will have to use the above command with -u parameter then the new branch will be pushed to Github.


Demo2 : Creating files on Github demo of git branching


In this Demo we will create a local branches and then push those to github.

commands are –

$ git checkout -b "new-branch"

  • The above command will create new branch and will also switch you to that new branch.
  • Next, you make any changes in ur code.
  • Next, stage those changes with the command (git add .)
  • Next, commit those changes with the command (git commit -m "your commit")
  • Then push it to remote branch with the command (git push -u origin [new branch name])

Pull Requests and the GitHub Flow


  • Using the pull request (PR) you are telling that you have pushed to a branch of a repo. and made changes in a separate branch.
  • We need to open the pull request, to discuss review and add more commits.
  • Once this is approved it will be merged into the base branch.

Demo1 : – Working with pull requests.


In this demo we will perform the below given task.

  1. Creating a pull request for our branch
  2. Adding more commits
  3. Adding comments
  4. Exploring the files in the PR (Pull request)
  5. Merging the PR into the branch
  6. Deleting the branch

Step 1: – How to create pull Request on Github ?

Inside your repo where you have created new branch, you will see a Compare and Pull request button.

It will show you the options to Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .

Step 2: – You can also manually create new pull request by clicking the Pull Request’s tab > New pull Request button.

Note – Able to merge. These branches can be automatically merged.

Note – Now under create pull request button we can also see Create Draft Pull Request (Cannot be merged until marked for review)

Step 3: – Now click Merge Pull request button and click confirm merge.

You will see a message – Pull request successfully merged and closed

And you will get a Delete branch button to delete your baranch.

Note – Inside this button there are 3 options

  • Create a Merge Commit – All commits from this branch will be added to the base branch via a merge commit.
  • Squash and merge – The 1 commit from this branch will be added to the base branch.
  • Rebase and merge – The 1 commit from this branch will be Rebased and added to the base branch.

Step 4: – I clicked on Delete Branch and now I got the message – @trickyj trickyj deleted the add-installation branch now


Note – Once you delete or make changes on GitHub website you will have to fetch/Pull those to your local repo.


% git branch

  • add-installation
  • master

% git fetch
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/trickyj/react_auth0_app_1
0df7a36..4bcaa13 master -> origin/master


% git pull
Updating 0df7a36..4bcaa13
Fast-forward
installation.txt | 29 +++++++++++++++++++++++++++++
src/Callback.js | 3 ++-
2 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 installation.txt


% git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean


Error: The following directories are not writable by your user:

In Linux / Unix at times you might encounter such Error: The following directories are not writable by your user:

/usr/local/lib/pkgconfig

Current file / folder permission, users, groups or attributes.

Terminal --> ls -la /usr/local/lib/         

drwxr-xr-x   4 root     wheel     128 Jul 10 21:27 pkgconfig

Solution –

You should change the ownership of these directories to your user.

sudo chown -R $(whoami) /usr/local/lib/pkgconfig

Terminal --> ls -la /usr/local/lib/         

drwxr-xr-x   4 JENNY  wheel     128 Jul 10 21:27 pkgconfig

And make sure that your user has write permission.

chmod u+w /usr/local/lib/pkgconfig

Terminal --> ls -la /usr/local/lib/         

drwxr-xr-x   4 JENNY  wheel     128 Jul 10 21:27 pkgconfig

What happens when you accidentally commit a large file in your local repo?

This was the error message I got when I tried to upload my changes to the remote repo. git push origin master.

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: e397fc16b6c3b712eb7068d69417a5b1
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File final_movie.mov is 317.20 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/trickyj/daboo.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/trickyj/daboo.git'

In order to resolve the above error. I wanted to remove that large size .mov file from my previous commit.

The first thing that came in my mind was to manually delete the final_movie.mov file from my project folder on my laptop. Then commit the changes.

But, this didn’t work. I was still getting the same error. The .mov file was already stored in my .git folder on my local machine project folder.

I searched on git documentation “how to remove the file from the previous commit”
I came across through this document – https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Removing a File from Every Commit
This occurs fairly commonly. Someone accidentally commits a huge binary file with a thoughtless git add ., and you want to remove it everywhere. Perhaps you accidentally committed a file that contained a password, and you want to make your project open source. filter-branch is the tool you probably want to use to scrub your entire history. To remove a file named passwords.txt from your entire history, you can use the –tree-filter option to filter-branch:

$ git filter-branch –tree-filter ‘rm -f passwords.txt’ HEAD
Rewrite 6b9b3cf04e7c5686a9cb838c3f36a8cb6a0fc2bd (21/21)
Ref ‘refs/heads/master’ was rewritten
The –tree-filter option runs the specified command after each checkout of the project and then recommits the results. In this case, you remove a file called passwords.txt from every snapshot, whether it exists or not. If you want to remove all accidentally committed editor backup files, you can run something like git filter-branch --tree-filter 'rm -f *~' HEAD.

You’ll be able to watch Git rewriting trees and commits and then move the branch pointer at the end. It’s generally a good idea to do this in a testing branch and then hard-reset your master branch after you’ve determined the outcome is what you really want. To run filter-branch on all your branches, you can pass –all to the command.

My issue was resolved.

screenshots for reference

This slideshow requires JavaScript.

 

 

Python / Django commands (unix)

Run these commands on the terminal.

Create a virtual environment first with the below-given command.

note:- the dot at the end means the current directory.

virtualenv -p python3 . 

Now activate the environment.

source bin/activate

To deactivate –

source bin/dactivate

Use these commands to check what all stuff has been installed in your virtual environment.

pip freeze

To install any package – 

pip install django==3.0.5

To create the project – 

django-admin.py startproject my_project .

To Run the server

python3 manage.py runserver


Next is to create an app, the command is –

python3 manage.py startapp my_app


To make a migration file

python manage.py makemigrations

To migrate to the database

python manage.py migrate


MODELS –

  • Models in python are a class which represent a table in a database
  • Each type of data we have (e.g Articles, Users) is represented by its own model
  • Each model maps to a single table in a database

ORM commands –

from Articles2.models import Articles

Articles.save()

Articles.objects.all()

Articles.title

Articles.objects.all()[0].title


Admin page –

Reset the admin portal password.

First, create a new user

python3 manage.py createsuperuser

Django Error: That port is already in use.

When trying to start/run Django server on your MAC machine getting this error –

Error: That port is already in use.

Solution?
  1. find out which service or application is using the default port 8000?
Spotlight on Network Utility to List Ports
  1. Press Command+Spacebar.
  2. Type the name of utilities that are buried, such as Network Utility.
  3. Click the keyboard return/enter key to launch the Network Utility app.
  4. Select the “Port Scan” tab.
  5. Enter the IP (such as 127.0.0.1), localhost, or domain name you wish to scan for open ports.
  6. Click scan button.
note – On mac machines by default the port 8000–8999 TCP is used by irdmi.

https://support.apple.com/en-us/HT202944

Port TCP or
UDP
Service or
protocol name
1
RFC2 Service name3 Used by
8000–8999 TCP irdmi Web service, iTunes Radio streams

This slideshow requires JavaScript.