Skip to content

Instantly share code, notes, and snippets.

View manojjha's full-sized avatar
🎯
Focusing

manoj jha manojjha

🎯
Focusing
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manojjha
manojjha / dateConvert.cs
Last active August 6, 2023 06:15
How to Convert String Dates to Date Format in Python and C#
using System;
using System.DateTime;
using System.Text.RegularExpressions;
public class DateConverter
{
public static DateTime ConvertStringToDate(string stringDate)
{
// The regular expression to match a date string with month in word.
string regex = @"^\d{4}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{1,2}$";
@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))
@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 / 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 / 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));
}

GIT CHEATSHEET

CREATE

From existing data
cd ~/projects/myproject
git init
git add .
def pyart(n):
mylist=[]
for i in range(1,n+1):
mylist.append("* "*i)
print("\n".join(mylist))
pyart(5)
@manojjha
manojjha / PY0101EN-2-2-Lists.ipynb
Created August 26, 2019 07:27
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.