Skip to content

Instantly share code, notes, and snippets.

View devmnj's full-sized avatar
💭
Exploring Algos

Manoj AP devmnj

💭
Exploring Algos
View GitHub Profile
@devmnj
devmnj / maping_with_typescript.ts
Created February 8, 2024 05:56
Typescript array map to a different type
//target type
export type LatestInvoice = {
id: string;
name: string;
image_url: string;
email: string;
@devmnj
devmnj / REPL.SQL
Created January 23, 2024 10:00
MSSQL REPLACING SINGLE QUOTE
UPDATE TABLE_NAME SET COL1= REPLACE(COL1,'''','"')
@devmnj
devmnj / backgrowndwkr.cs
Created January 22, 2024 17:48
Batchwise data fetching in Dapper-MYSQL, using Background Task in C# - Background worker.
static class BackgroundDataFetcher
{
private static int batchSize = 2;
public static BindingList<LedgerModel> ledgers = new BindingList<LedgerModel>();
public static async Task FetchAsync(int ledId = 0)
{
try
{
@devmnj
devmnj / panda_frame_error.py
Last active January 12, 2024 17:40
Steps to prepare dataframe for Algo in Python
# I encounter proplem while using Historical data
# For yfinance most of the case the data is in good shape
# The first thing I am looking for index column, of numbers. if it exist, need to replace with datetime
# the last thing I want make sure that the date column is in panda datetime type otherwise have to covert it.
df =pd.DataFrame(data['Success'])
df =df[['datetime','open','high','low','close','volume']]
df['datetime']= pd.to_datetime(df['datetime'])
df.set_index('datetime', inplace=True)
@devmnj
devmnj / pandas_xl_read_column.py
Last active December 31, 2023 05:59
Read excel file using Python, specify column range
import pandas as pd
import numpy as np
series=pd.read_excel(r'C:/Users/hp/OneDrive/documents/mahdata.xlsx',sheet_name='EASY', usecols='B:G',header=None,
index_col=False)
series= series.to_numpy()
data = np.flip(series,axis=0)
@devmnj
devmnj / conda-env
Created December 16, 2023 17:11
Anaconda env in Windows
Managing conda environments
It is recommended to install Zipline in an isolated conda environment. Installing Zipline in conda environments will not interfere your default Python deployment or site-packages, which will prevent any possible conflict with your global libraries. For more information on conda environment, see the Conda User Guide.
Assuming conda has been set up, you can create a conda environment:
$ conda create -n env_zipline python=3.10
Now you have set up an isolated environment called env_zipline, a sandbox-like structure to install Zipline. Then you should activate the conda environment by using the command
$ conda activate env_zipline
You can install Zipline by running
@devmnj
devmnj / conda-win11-pshell
Created December 16, 2023 17:10
Conda powershel error fix
Conda Error
`conda error error: argument COMMAND: invalid choice: 'activate'`
# solution
`conda init powershell`
@devmnj
devmnj / yarnfix-win11-powersshell
Created December 16, 2023 17:09
Yarn error fix
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
@devmnj
devmnj / loadimage.py
Created June 16, 2023 10:46
Function for load image from url for classification (Keras) - Python
def loadImage(url):
response = requests.get(url)
img_bytes = BytesIO(response.content)
img = Image.open(img_bytes)
img = img.convert('L')
# img = img.convert('1')
# img = img.convert('RGB')
img = img.resize((28, 28), Image.NEAREST)
img = keras.utils.img_to_array(img)
@devmnj
devmnj / keybase.md
Last active January 28, 2023 07:29

Keybase proof

I hereby claim:

  • I am devmnj on github.
  • I am devmnj (https://keybase.io/devmnj) on keybase.
  • I have a public key ASBneaQ1K2PbmDsm0g8_LYAgLc0zAvxCXj3ezNiNjjPlIwo

To claim this, I am signing this object: