Skip to content

Instantly share code, notes, and snippets.

View RahulDas-dev's full-sized avatar
🏠
Working from home

Rahul Das RahulDas-dev

🏠
Working from home
View GitHub Profile
@RahulDas-dev
RahulDas-dev / Dataclass_with_init.py
Created January 13, 2022 19:11
Dataclass with init ,field modification while object initialization
@dataclass(frozen=True, init= False)
class Dimension:
height: float
width: float
depth: float
def __init__(self,height,width,depth ):
object.__setattr__(self, "height", int(round(height)))
object.__setattr__(self, "width", int(round(width)))
object.__setattr__(self, "depth", int(round(depth)))
@RahulDas-dev
RahulDas-dev / dataclass.py
Last active December 18, 2022 16:20
Dataclass Example
from dataclasses import dataclass, field
from pprint import pprint
import inspect
@dataclass(frozen=True)
class Dimension:
height: float
width: float
depth: float
@RahulDas-dev
RahulDas-dev / Sqlx_Sqlite.rs
Last active February 17, 2023 07:57
Sqlx::Sqlite Integration with Rust
/*
[dependencies]
sqlx = { version = "0.5.9", features = [ "runtime-async-std-native-tls", "sqlite" ] }
async-std = { version = "1.6", features = [ "attributes" ] }
futures = "0.3.18"
*/
use std::result::Result;
use sqlx::{sqlite::SqliteQueryResult, Sqlite, SqlitePool, migrate::MigrateDatabase};
@RahulDas-dev
RahulDas-dev / startup.ts
Last active December 3, 2021 08:04
How To trigger commands from Frontend to change the state object
private registerListeners() {
appWindow.listen('config-init', event => {
console.log('registerListeners :', event.payload, event.event)
})
appWindow.listen('page-loaded', event => {
//console.log('page-loaded :', event.payload, event.event)
appWindow.show()
})
appWindow.once('tauri://close-requested', this.window_close_handeler)
appWindow.once('tauri://destroyed', this.window_close_handeler)
@RahulDas-dev
RahulDas-dev / config_plugin.rs
Last active December 4, 2021 13:26
App Config Plug in defination
use tauri::{plugin::Plugin, Runtime, Invoke, State, Window, PageLoadPayload, Manager};
use tauri::async_runtime::Mutex;
use std::sync::Arc;
use super::AppConfig;
type Tconfig = Arc<Mutex<AppConfig>>;
pub struct ConfigPlugin<R: Runtime> {
invoke_handler: Box<dyn Fn(Invoke<R>) + Send + Sync>,
}
@RahulDas-dev
RahulDas-dev / app_config.rs
Last active December 4, 2021 13:25
tauri app App_config Object
use std::path::PathBuf;
use std::default::Default;
use std::{fs::File, fs};
use std::io::{prelude::*,Error,ErrorKind};
use serde::{Serialize, Deserialize};
use tauri::{Size,PhysicalSize, Position, PhysicalPosition};
pub mod config_plugin;
@RahulDas-dev
RahulDas-dev / Create Virtual Enviroment.md
Last active August 20, 2022 15:04
Python virtual environment creation using venv module

Create Environment using venv Module

  • For Windows python -m venv --prompt <venv_promt> <venv_directory>
  • For Linux python3 -m venv --prompt <venv_promt> <venv_directory>

Activate Environment

  • For Windows <venv_directory>\Scripts\activate.bat
  • For Linux source <venv_directory>/bin/activate

Check Environment Creation

@RahulDas-dev
RahulDas-dev / data clean.md
Last active May 23, 2021 17:24
Pandas data frame cleaning and house keeping

Import statement

import os
import gc

import pandas as pd
@RahulDas-dev
RahulDas-dev / image_download.py
Last active April 16, 2021 10:17
Image Download using Python3
import os
import shutil
import pandas as pd
import requests
datadir = '/your/path/to/url_csv/file/ulfile.csv' # Change this variable and point 2 sitable csv file path
downloadDir='/your/path/to/download/directory' # Change this variable and point 2 image download directory

List of basic Python Packages for Linting,Formating and Jupyter notebook requirement_commnon.txt

Package Name Package description
pylint Python Linter/A simple program which checks Python source files code for errors
autopep8 autopep8 automatically formats Python code to conform to the PEP 8 style guide
flake8
flake8-import-order
flake8-builtins
flake8-logging-format