Skip to content

Instantly share code, notes, and snippets.

View manojjha's full-sized avatar
🎯
Focusing

manoj jha manojjha

🎯
Focusing
View GitHub Profile
@manojjha
manojjha / PY0101EN-1-1-Types.ipynb
Created August 26, 2019 06:36
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manojjha
manojjha / PY0101EN-1-1-Types.ipynb
Created August 26, 2019 06:37
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manojjha
manojjha / PY0101EN-2-1-Tuples.ipynb
Created August 26, 2019 07:17
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manojjha
manojjha / PY0101EN-2-2-Lists.ipynb
Created August 26, 2019 07:27
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def pyart(n):
mylist=[]
for i in range(1,n+1):
mylist.append("* "*i)
print("\n".join(mylist))
pyart(5)

GIT CHEATSHEET

CREATE

From existing data
cd ~/projects/myproject
git init
git add .
@manojjha
manojjha / gist:0bf5ceb7e8e3125328914afd9bec5638
Created February 9, 2022 17:56
Convert Table item in to List of KeyValuePair<string, Decimal> in Abbyy Flexicapture
List<KeyValuePair<string, decimal>> sumList = new List<KeyValuePair<string, decimal>>();
for(int i = 0; i < rowCount; i++)
{
description = Context.Field("description").Items[i].Text;
amount = Context.Field("amount").Items[i].Text;
sumList.Add(new KeyValuePair<string, decimal>(description, amount));
}
@manojjha
manojjha / increasing_decreasing.py
Created December 30, 2022 05:48
Find if array is in increasing order or decreasing order in python
def checkType(arr, n):
# If the first two and the last two elements
# of the array are in increasing order
if (arr[0] <= arr[1] and arr[n-2] <= arr[n-1]):
print("Increasing");
elif (arr[0] >= arr[1] and arr[n-2] >= arr[n-1]):
print("Decreasing");
@manojjha
manojjha / factorial.sh
Created January 11, 2023 07:57
Shell script to find factorial of a number
#!/bin/bash
echo "Enter a number:"
read number
factorial=1
counter=$number
while [ $counter -gt 0 ]
do
@manojjha
manojjha / factorial2.sh
Created January 11, 2023 08:00
Shell script to find factorial of a number
#!/bin/bash
echo "Enter a number:"
read num
fact=1
for((i=1;i<=num;i++))
do
fact=$((fact*i))