Friday, September 3, 2021

Two Types of Matrix Multiplication Using NumPy



How are two matrices multiplied according to the math rules: Khan Academy

(base) C:\Users\ashish>python
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> a = [[1, -1], [1, 2]]
>>> b = [[3], [4]]

>>> a * b
Traceback (most recent call last):
  File "[stdin]", line 1, in [module]
TypeError: can't multiply sequence by non-int of type 'list'

>>> a = np.array(a)
>>> b = np.array(b)

>>> a
array([[ 1, -1],
       [ 1,  2]])

>>> b
array([[3],
       [4]])

>>> np.matmul(a,b)
array([[-1],
       [11]])

>>> np.matmul(b, a)
Traceback (most recent call last):
  File "[stdin]", line 1, in [module]
ValueError: shapes (2,1) and (2,2) not aligned: 1 (dim 1) != 2 (dim 0)

>>> a.dot(b)
array([[-1],
       [11]])

>>> np.dot(a, b)
array([[-1],
       [11]])

>>> a.b
Traceback (most recent call last):
  File "[stdin]", line 1, in [module]
AttributeError: 'numpy.ndarray' object has no attribute 'b'

>>> np.dot(b, a)
Traceback (most recent call last):
  File "[stdin]", line 1, in [module]
ValueError: shapes (2,1) and (2,2) not aligned: 1 (dim 1) != 2 (dim 0)

# How about an element to element multiplication?
# Note: this is not how math books do it

>>> np.multiply(a, b)
array([[ 3, -3],
       [ 4,  8]])

>>> np.multiply(b, a)
array([[ 3, -3],
       [ 4,  8]])

>>> a*b
array([[ 3, -3],
       [ 4,  8]])

>>> a = [[1, 1], [2, 2]]
>>> b = [[0, 0], [1, 1]]
>>> a = np.array(a)
>>> b = np.array(b)
>>> a*b
array([[0, 0],
       [2, 2]])

>>> a = [[0, 1], [2, 3]]
>>> a = np.array(a)
>>> b = [[5, 10], [15, 20]]
>>> b = np.array(b)
>>> a*b
array([[ 0, 10],
       [30, 60]])
>>>

Ref: docs.scipy.org

Tags: Technology,Python,NumPy

Using NumPy's 'random' package (randint and shuffle)



randint

>>> np.random.randint(4) 0 >>> np.random.randint(4) 3 >>> np.random.randint(4) 2 >>> np.random.randint(4) 0

shuffle

>>>arr = np.arange(10) >>>np.random.shuffle(arr) >>>arr [1 7 5 2 9 4 3 6 0 8] # random - - - >>> import numpy as np >>> arr = [0, 1, 2, 3] >>> np.random.shuffle(arr) >>> arr [1, 0, 2, 3] >>> np.random.shuffle(arr) >>> arr [0, 1, 3, 2] >>> Tags: Technology,Python,NumPy

Dot Product using Python, NumPy, Matplotlib



Dot product / Inner product / Scalar product

Algebraic Definition
Geometric Definition
Python Code
from matplotlib.pyplot import plot point1 = [0, 0] point2 = [3, 0] x_values = [point1[0], point2[0]] y_values = [point1[1], point2[1]] plot(x_values, y_values, 'b-') # format: Blue dashes point1 = [0, 0] point2 = [3, 3] x_values = [point1[0], point2[0]] y_values = [point1[1], point2[1]] plot(x_values, y_values, color='red', marker='o')
import numpy as np a = np.array([3, 0]) b = np.array([3, 3]) c = np.array([1, 1]) print("a, b, c:", a, b, c, end = "\n\n") print("a.dot(b):", a.dot(b)) print("b.dot(a):", b.dot(a), end = "\n\n") print("np.dot(a, b):", np.dot(a, b)) print("sum(a*b):", sum(a*b), end = "\n\n") print("np.dot(b, c):", np.dot(b, c)) print("sum(b*c):", sum(b*c), end = "\n\n") theta = np.pi / 4 print("theta = np.pi / 4") print("np.linalg.norm(a) * np.linalg.norm(b) * np.cos(theta):", np.linalg.norm(a) * np.linalg.norm(b) * np.cos(theta)) a, b, c: [3 0] [3 3] [1 1] a.dot(b): 9 b.dot(a): 9 np.dot(a, b): 9 sum(a*b): 9 np.dot(b, c): 6 sum(b*c): 6 theta = np.pi / 4 np.linalg.norm(a) * np.linalg.norm(b) * np.cos(theta): 9.0 Tags: Technology,Python,Data Visualization,Machine Learning,

Google Sites, Tor Exit Nodes and Captcha



Top 10 Websites

Rank - Website - Monthly Visitors - Country of Origin - Category 1 Google.com 92.5B U.S. Search Engines 2 Youtube.com 34.6B U.S. TV Movies and Streaming 3 Facebook.com 25.5B U.S. Social Networks and Online Communities 4 Twitter.com 6.6B U.S. Social Networks and Online Communities 5 Wikipedia.org 6.1B U.S. Dictionaries and Encyclopedias 6 Instagram.com 6.1B U.S. Social Networks and Online Communities 7 Baidu.com 5.6B China Search Engines 8 Yahoo.com 3.8B U.S. News and Media 9 xvideos.com 3.4B Czech Republic Adult 10 pornhub.com 3.3B Canada Adult ... 41 Walmart.com 718.6M U.S. Marketplace 42 Bilibili.com 686.0M China Animation and Comics 43 Tiktok.com 663.2M China Social Networks and Online Communities 44 Paypal.com 657.2M U.S. Financial Planning and Management 45 Google.de 624.5M Germany Search Engines 46 Amazon.co.jp 619.2M Japan Marketplace 47 Aliexpress.com 611.0M China Marketplace 48 Amazon.de 608.8M Germany Marketplace 49 Rakuten.co.jp 593.4M Japan Marketplace 50 Amazon.co.uk 579.7M United Kingdom Marketplace

Top 50 Websites

Google.com

YouTube

2021-Sep-02
2021-Aug-24

survival8.blogspot.com

Ref: visualcapitalist Tags: Technology,Cyber Security,Web Scraping,

Wednesday, September 1, 2021

Extracting Text from Docx, Doc and Pdf files Using Python




import os
import docx # pip install python-docx # Does not support .pdf and .doc
import PyPDF2

from docx import Document

SUPPORTED_FORMATS = ['pdf', 'doc', 'docx']
WORD_FORMATS = ['doc', 'docx']

For DOCX

f_list = [] for dirpath, subdirs, files in os.walk("."): for f in files: if f.split(".")[1] == "docx" and f[0] != "~": f_list.append(os.path.join(dirpath, f)) d_list = [] for f in f_list: d_list.append(Document(f)) t_list = [] for d in d_list: para_text = "" for para in d.paragraphs: para_text = para_text + " " + para.text t_list.append(para_text)

FOR PDF

f_list = [] for dirpath, subdirs, files in os.walk("."): for f in files: if f.split(".")[1] == "pdf" and f[0] != "~": #print(f, dirpath) f_list.append(os.path.join(dirpath, f)) d_list = [] t_list = [] for f in f_list: pdfFileObj = open(f, 'rb') pdfReader = PyPDF2.PdfFileReader(pdfFileObj) d_list.append(pdfReader) text = "" for pageObj in pdfReader.pages: text = text + " " + pageObj.extractText() t_list.append(text) pdfFileObj.close()

For DOC

import win32com.client word = win32com.client.Dispatch("Word.Application") word.visible = False wb = word.Documents.Open(r'D:\xyz.doc') doc = word.ActiveDocument print(doc.Range().Text) Tags: Technology,Python,Natural Language Processing,

Managing task on Windows using CMD



Managing task on Windows using CMD using "tasklist", "taskkill" and "findstr".

(base) CMD>tasklist | findstr "WINWORD*"
WINWORD.EXE --  3164 Console --   7    251,092 K
WINWORD.EXE --  9292 Console --   7    245,508 K
WINWORD.EXE -- 13640 Console --   7    246,748 K
WINWORD.EXE -- 10288 Console --   7    242,704 K
WINWORD.EXE -- 19244 Console --   7    246,996 K
WINWORD.EXE -- 18416 Console --   7    246,552 K
WINWORD.EXE -- 12380 Console --   7    163,932 K

(base) CMD>taskkill /F /PID 3164
SUCCESS: The process with PID 3164 has been terminated.

(base) CMD>taskkill /IM "WINWORD.exe" /F
SUCCESS: The process "WINWORD.EXE" with PID 13640 has been terminated.
SUCCESS: The process "WINWORD.EXE" with PID 10288 has been terminated.
SUCCESS: The process "WINWORD.EXE" with PID 19244 has been terminated.
SUCCESS: The process "WINWORD.EXE" with PID 18416 has been terminated.
SUCCESS: The process "WINWORD.EXE" with PID 12380 has been terminated.

Tags: Technology,Windows CMD,

Convert MS Word files into PDF format using Python on Windows




import os
import PyPDF2

import sys
import comtypes.client

SUPPORTED_FORMATS = ['pdf', 'doc', 'docx']
WORD_FORMATS = ['doc', 'docx']

f_list = []
for dirpath, subdirs, files in os.walk("."):
    for f in files:
        if f.split(".")[1] in WORD_FORMATS and f[0] != "~":
            f_list.append(os.path.join(dirpath, f))
        

"""
The following code converts "doc" and "docx" files to "pdf". But once it opens the files, due to some issue in our code
(usually an unattended Word prompt) it does not closes the files properly and the Operating System file lock 
remains open on the file. So the code runs for one time but not the second time unless we end the "Word" program 
instances from the Task Manager.
"""

os.system('taskkill /IM "WINWORD.exe" /F')
wdFormatPDF = 17

for f in f_list:
    in_file = os.path.abspath(f)
    out_file = in_file.split(".")[0] + ".pdf".strip()
        
    word = comtypes.client.CreateObject('Word.Application')
    word.Visible = True
    
    doc = word.Documents.Open(in_file)
    
    doc.SaveAs(out_file, FileFormat=wdFormatPDF)

    #doc.Close()
    #word.Quit()
    os.system('taskkill /IM "WINWORD.exe" /F') 
    

Other Notes

import docx # pip install python-docx # Does not support .pdf and .doc Tags: Technology,Python,Natural Language Processing,

Monday, August 30, 2021

Index of English Lessons

Nursery Rhymes

  1. Aiken Drum (Video & Lyrics)
  2. Bob The Train (Video & Lyrics)
  3. Baa Baa Black Sheep (Video and Lyrics)
  4. Twinkle, twinkle, litte star! (Full Version (Video))
  5. Twinkle twinkle, little star (Read it loud)
  6. Twinkle, Twinkle, Little Star (Word by Word Reading)

Tutorial

  1. Singular and Plural (English Lessons, Hour 1)
  2. Was, were, have, has, had (English Lessons, Hour 2)
  3. KG-K5 Reading (English Lessons, Hour 3)
  4. First 100 Fry Sight Words (English Lessons, Hour 4)
  5. Second 100 Fry Sight Words (English Lessons, Hour 5)
  6. English Questionnaire Application (Level Earth, Hour 6)
  7. Tenses (Hour 7)
  8. Hour 8 - Rules for pronouncing 'I'
  9. Hour 9 - Nouns
  10. Hour 10 - Common Noun and Proper Noun
  11. Collective Nouns (Hour 11)

Literature (Level 1)

  1. Pitara 1 (Story 1 - Kaku, Rani and Friends)
  2. Pitara 1 (Story 2 - Shiny, Tillu and Billu)
  3. Pitara 1 (Story 3 - Rani and Soni meets Sheru)
  4. Pitara 2 (Story 1 - Tillu Cares for the Books)
  5. Pitara 2 (Story 2 - Rani Learns Fast)

Literature (Level 6)

  1. Who did Patrick's Homework? (Read it loud)
  2. Who did Patrick's Homework? (Translation)
  3. Pronunciation of Words with I in it (Who did Patrick's homework)
  4. How the dog found himself a new master (Translation)
  5. Bamboo Curry (Read it loud)
  6. Bamboo curry (Word by Word Reading)

Poems (Level 6)

  1. Ice-cream man (Poem and Hindi Translation)
  2. A house, a home (Poem and Translation)
  3. A house, a home (Poem, Word Meanings, Read it loud)

Downloads

  1. Download fiction books (March 2018)
  2. Download self-help books (May 2018)
  3. English Grammar and Business Communication Books

Miscellaneous

  1. 500 Words That Belong in Your Reading Vocabulary
  2. Phonetics - An Introduction
  3. There are literally infinite number of words!

Live Class Videos

  1. Alphabets

    1. Alphabets with Prince and Piyush (Day 1)
    2. ABCD with Prince and Piyush 20220420 101845
    3. ABCD with Piyush 20220421
    4. ABCD with Prince 20220421 1830
  2. Twinkle Twinkle Little Star

    1. Twinkle Twinkle Little Star (With Prince and Piyush) 20220323 (YouTube)
    2. Twinkle Twinkle Little Star by Prince and Piyush (20220323)
    3. Twinkle Twinkle Little Star (With Prince and Piyush) 20220324
    4. Twinkle Twinkle Little Star With Prince and Piyush 20220324 (YouTube)
    5. Twinkle Twinkle 20220420 104301 (With Prince and Piyush)
    6. Twinkle Twinkle (First two para) (20220421 175408)
    7. Twinkle Twinkle (with Prince and Piyush) 20220421 1843
    8. Twinkle Twinkle (2 para with Prince 20220421)
    9. Twinkle Twinkle (2 para with Prince and Piyush) 20220421 182246
    10. Twinkle Twinkle (2 Para with Piyush) 20220421 183249
    11. Twinkle Twinkle (all 5 para) with Prince and Piyush 20220420 105338
  3. Miscellaneous

    1. Rhymes with Piyush (Day 2)
    2. Rhymes with Prince and Piyush (Day 3)

Dictation Trials

  1. Words with Alphabets With Prince (2022-Mar-18)
  2. Spelling Mistakes by Shiva 2022-Mar-19

Written Trials

  1. Alphabets Test with Prince (2022-03-16)
  2. Alphabets Test With Prince and Piyush (2022-Mar-17)
  3. Alphabets Test With Prince and Piyush (2022-Mar-18)
  4. Alphabetical Words with Prince (2022_03_20)
  5. Alphabets with Piyush 2022_03_20
  6. Alphabetical Words with Prince (2022-03-21)
  7. Alphabets with Piyush (2022-03-21)
  8. Alphabets with Piyush and Shiva (2022 03 22)
  9. Alphabetical Words (Prince and Shiva, 2022 03 22)
Tags: Communication Skills,Natural Language Processing,English Lessons,

Friday, August 27, 2021

Ten Suggestions (a lesson and a joke)



“I’ve got some good news... and I’ve got some bad news,” the lawgiver yells to them. “Which do you want first?” “The good news!” the hedonists reply. “I got Him from fifteen commandments down to ten!” “Hallelujah!” cries the unruly crowd. “And the bad?” “Adultery is still in.” - - - The Hedonists think: Why should we be judged according to another’s rule? And yet judged we are. After all, God didn’t give Moses “The Ten Suggestions,” he gave Commandments; and if I’m a free agent, my first reaction to a command might just be that nobody, not even God, tells me what to do. Even if it’s good for me.
Tags: Behavioral Science,Communication Skills,Emotional Intelligence,Politics,Psychology,Joke

English Questionnaire Application (Level Earth, Hour 4)



{{$index + 1}}) {{ x.questext }}

 A. {{x.optiontext_a}}
 B. {{x.optiontext_b}}
 C. {{x.optiontext_c}}
 D. {{x.optiontext_d}}
 
Tags: Technology,JavaScript,Web Development,Communication Skills,

Thursday, August 26, 2021

Upper Respiratory Tract Infection



An upper respiratory tract infection (URTI) is an illness caused by an acute infection, which involves the upper respiratory tract, including the nose, sinuses, pharynx, larynx or trachea.

Medication
Amoxycillin 500
Period: 5 Days
Timing: Day and Night (after food)

Medication Side-effects
Rare: fever

URTI

A common viral infection that affects the nose, throat and airways. Upper respiratory tract infections usually resolve within seven to 10 days. Symptoms usually resolve within two weeks and include a scratchy or sore throat, sneezing, stuffy nose and cough. Treatment includes rest and medication to relieve symptoms.

Stats

Very common: More than 10 million cases per year (India) Spreads easily Usually self-treatable Usually self-diagnosable Lab tests or imaging rarely required Short-term: resolves within days to weeks

HOW IT SPREADS

By airborne respiratory droplets (coughs or sneezes). By touching a contaminated surface (blanket or doorknob). By saliva (kissing or shared drinks). Tags:Technology,Medicine,Science,

Command 'git stash'



(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash

No local changes to save

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status

On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> echo "20210826" > 20210826.txt

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status

On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
    (use "git add <file>..." to include in what will be committed)
        20210826.txt

nothing added to commit but untracked files present (use "git add" to track)

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash

No local changes to save

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git add -A

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status

On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   20210826.txt

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash

Saved working directory and index state WIP on main: 9f1b42f Merge branch 'test_branch' into main

(base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git branch
* main

No changes appear in "Git Log"

1: Here we have stashed changes. (base) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git log commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229 2: C:\Users\Ashish Jain\OneDrive\Desktop\(2)\repo_for_testing>git log commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main commit 087a5ca85b88f7303d025e8770183a6eabbeca7a Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:29:09 2021 +0530 20210721 1229

Now We Apply Our Stashaed Changes Again

C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing 08/26/2021 06:05 PM <DIR> . 08/26/2021 06:05 PM <DIR> .. 08/26/2021 04:15 PM 368 .gitignore 08/26/2021 04:15 PM 30 20210528_test_branch.txt 08/26/2021 04:15 PM 17 202107141543.txt 08/26/2021 04:15 PM 17 202107141608.txt 08/26/2021 04:15 PM 17 202107211228.txt 08/26/2021 04:15 PM 11,558 LICENSE 08/26/2021 04:15 PM 11 newFile.txt 08/26/2021 04:15 PM 38 README.md 08/26/2021 04:15 PM 23 test_file_20210528.txt 9 File(s) 12,079 bytes 2 Dir(s) 66,473,070,592 bytes free C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list stash@{0}: WIP on main: 9f1b42f Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git show commit 9f1b42fe6b2cf1fbc3781cdb463b284f871ad291 (HEAD -> main, origin/test_branch, origin/main, origin/HEAD) Merge: d210505 087a5ca Author: unknown <ashishjain1547@gmail.com> Date: Wed Jul 21 12:41:37 2021 +0530 Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash apply On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 20210826.txt C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 20210826.txt C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>dir Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing 08/26/2021 06:16 PM <DIR> . 08/26/2021 06:16 PM <DIR> .. 08/26/2021 04:15 PM 368 .gitignore 08/26/2021 04:15 PM 30 20210528_test_branch.txt 08/26/2021 04:15 PM 17 202107141543.txt 08/26/2021 04:15 PM 17 202107141608.txt 08/26/2021 04:15 PM 17 202107211228.txt 08/26/2021 06:16 PM 13 20210826.txt 08/26/2021 04:15 PM 11,558 LICENSE 08/26/2021 04:15 PM 11 newFile.txt 08/26/2021 04:15 PM 38 README.md 08/26/2021 04:15 PM 23 test_file_20210528.txt 10 File(s) 12,092 bytes 2 Dir(s) 66,475,622,400 bytes free C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash show 20210826.txt | 1 + 1 file changed, 1 insertion(+) C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list stash@{0}: WIP on main: 9f1b42f Merge branch 'test_branch' into main C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash clear C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash list C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing>git stash show No stash entries found. C:\Users\Ashish Jain\OneDrive\Desktop\(1)\repo_for_testing> Ref: git-scm Tags: Technology,GitHub,

Command 'git config'



Git config variables can be stored in 3 different levels. Each level overrides values in the previous level. --global use global config file --system use system config file --local use repository config file - - - - - - - - - - (base) CMD> git config usage: git config [<options>] Config file location --global use global config file --system use system config file --local use repository config file --worktree use per-worktree config file -f, --file <file> use given config file --blob <blob-id> read config from given blob object Action --get get value: name [value-regex] --get-all get all values: key [value-regex] --get-regexp get values for regexp: name-regex [value-regex] --get-urlmatch get value specific for the URL: section[.var] URL --replace-all replace all matching variables: name value [value_regex] --add add a new variable: name value --unset remove a variable: name [value-regex] --unset-all remove all matches: name [value-regex] --rename-section rename section: old-name new-name --remove-section remove a section: name -l, --list list all -e, --edit open an editor --get-color find the color configured: slot [default] --get-colorbool find the color setting: slot [stdout-is-tty] Type -t, --type <> value is given this type --bool value is "true" or "false" --int value is decimal number --bool-or-int value is --bool or --int --path value is a path (file or directory name) --expiry-date value is an expiry date Other -z, --null terminate values with NUL byte --name-only show variable names only --includes respect include directives on lookup --show-origin show origin of config (file, standard input, blob, command line) --show-scope show scope of config (worktree, local, global, system, command) --default <value> with --get, use default value when missing entry - - - - - - - - - - (base) CMD> git config --list http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt http.sslbackend=openssl diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true credential.helper=manager add.interactive.usebuiltin=true core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait core.autocrlf=true core.fscache=true core.symlinks=true pull.rebase=false user.email=ashishjain1547@gmail.com filter.lfs.required=true filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process* - - - - - - - - - - (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.email ashishjain1547@gmail.com If a variable is not set, it returns empty line and fails silently. (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.name (base) C:\Users\Ashish Jain\OneDrive\Desktop> - - - - - - - - - -

Check Global Configurations:

(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain (base) C:\Users\Ashish Jain>dir .gitconfig Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain 05/03/2021 09:52 PM 167 .gitconfig 1 File(s) 167 bytes 0 Dir(s) 66,402,430,976 bytes free ~~~ (base) C:\Users\Ashish Jain>type .gitconfig [user] email = ashishjain1547@gmail.com [filter "lfs"] required = true clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process - - - - - - - - - -

How to view all settings?

Run git config --list, showing system, global, and (if inside a repository) local configs Run git config --list --show-origin, also shows the origin file of each config item (base) C:\Users\Ashish Jain>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process - - - - - - - - - -

When We Are in a Repository:

(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing> (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process file:.git/config core.repositoryformatversion=0 file:.git/config core.filemode=false file:.git/config core.bare=false file:.git/config core.logallrefupdates=true file:.git/config core.ignorecase=true file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.git file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* file:.git/config branch.main.remote=origin file:.git/config branch.main.merge=refs/heads/main - - - - - - - - - -

Check Which Entries Are At Which Level

(base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-scope --show-origin system file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt system file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl system file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain system file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process system file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true system file:E:/programfiles/Git/etc/gitconfig credential.helper=manager system file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true system file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait system file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true system file:E:/programfiles/Git/etc/gitconfig core.fscache=true system file:E:/programfiles/Git/etc/gitconfig core.symlinks=true system file:E:/programfiles/Git/etc/gitconfig pull.rebase=false global file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process local file:.git/config core.repositoryformatversion=0 local file:.git/config core.filemode=false local file:.git/config core.bare=false local file:.git/config core.logallrefupdates=true local file:.git/config core.ignorecase=true local file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.git local file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* local file:.git/config branch.main.remote=origin local file:.git/config branch.main.merge=refs/heads/main Tags: Technology,GitHub,

Tuesday, August 24, 2021

Using Git commands on Android Phone



Step 1: Install "Termux" App from Play Store.
Step 2: Open "Termux" App and run "apt update".
Step 3: Install "git" using command "pkg install git".
Step 4: Trying out "git clone" on a Public Repository hosted on GitHub.
Step 5: Viewing the files.
Step 6: Allowing "Storage Access" for "Termux" via "Android Settings".
Step 7: Moving public repository files here and there for easy access outside of Termux.

Viewing files in 'Downloads' on Lenovo Moto Phone

Redme MIUI Does Not Allow Viewing Termux Files via Downloads App
Opening Termux files via "Downloads App" on Lenovo Moto C Plus. 1.a. Open "Downloads App"
1.b.
2. Select "Termux" in the "Left Sidebar Panel Menu".
3. Now you are in the "Termux" home directory.
Technology,GitHub,

Monday, August 23, 2021

Multifactor Authentication protects you from scrapers and automation tools (Case study of LinkedIn)



1. Linkedin Scraping and Logging Issue with MFA
2. LinkedIn Scraping - Google Auth fails as Google knows that you in an automated environment
Tags: Technology,Cyber Security,Web Scraping,