Skip to content

Instantly share code, notes, and snippets.

View utgupta27's full-sized avatar
🏗️
Engineering MagicStudio.com

Utsav Gupta utgupta27

🏗️
Engineering MagicStudio.com
View GitHub Profile
@utgupta27
utgupta27 / main.dart
Created June 28, 2021 04:56
State Management in Flutter using Provider(5.0.0) Package
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
void main() async{
WidgetsFlutterBinding.ensureInitialized();
runApp(
ChangeNotifierProvider(
create: (context) => Counter(),
child: MyApp(),),
);
@utgupta27
utgupta27 / databaseHandlerTodos.dart
Created June 28, 2021 05:05
Flutter Sqflite(2.0.0+3) database CRUD operation implementation.
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
// Modify the todoDataModle.dart's location according to your project.
import 'package:<your-package-directory>/dataModle/todoDataModle.dart';
class DatabaseHandlerTodos {
static final DatabaseHandlerTodos instance = DatabaseHandlerTodos._init();
static Database? _database;
DatabaseHandlerTodos._init();
@utgupta27
utgupta27 / encrypt.py
Created June 28, 2021 05:09
Implementation of Python PyAesCrypt module to encrypt and decrypt any file.
"Install pyAesCrypt module using pip-command"
import pyAesCrypt
import os
class Encrypt():
"""
Contains encryptdata() & decryptdata() functions that uses AES256-CBC encryption
algorithm to encrypt and decrypt Files/Databases where the buffer size if 64Kb.
"""
def __init__(self):
@utgupta27
utgupta27 / PalmRecoginition.py
Created June 28, 2021 05:13
Palm Recognition using Python3, OpenCV & Mediapipe package.
import cv2
import mediapipe
import time
class HandDetection:
def __init__(self, markLandmarks=list(range(21)), drawPalm=True, mark=True):
self.mark = mark
self.delayFrame = 1
self.prevTime = 0
@utgupta27
utgupta27 / FaceRecoginition.py
Created June 28, 2021 05:14
Face Recognition using Python3, OpenCV & Mediapipe package.
import cv2 as cv
import mediapipe
import time
class FaceDetection:
def __init__(self) -> None:
self.delayFrame = 1
self.prevTime = 0
self.currTime = 0
@utgupta27
utgupta27 / PoseRecoginition.py
Created June 28, 2021 05:15
Human Pose Recognition using Python3, OpenCV & Mediapipe package
import cv2 as cv
import mediapipe
import time
class PoseDetection():
def __init__(self, markLandmarks=list(range(21)), drawPose=True, mark=True) -> None:
self.stream = cv.VideoCapture(0)
self.drawPose = drawPose
self.mark = mark
@utgupta27
utgupta27 / encryptDatabase.py
Created June 28, 2021 05:23
Password Encrypted SQLite database package CRUD operation implementation.
"Using SQLite3 database for storing the data locally on the machine"
import sqlite3
import os
"Importing the Encrypt class for encryption and decryption of databases"
from encrypt import Encrypt
class UserBase():
"""
This UserBase() class contains all the methods/functions to manipulate
@utgupta27
utgupta27 / bottmNavigationBar.dart
Created June 28, 2021 05:34
Switch to Multiple Pages using Bottom Navigation Bar Widget in Flutter.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class BottomNavyBar extends StatelessWidget {
BottomNavyBar({
Key? key,
this.selectedIndex = 0,
this.showElevation = true,
this.iconSize = 24,
this.backgroundColor,
@utgupta27
utgupta27 / ytdownloader.py
Last active June 28, 2021 05:47
Implementation of PyTube package to download Youtube Videos.
# Importing pytube module for downloading and selecting the streams for the video to be downloaded
from pytube import YouTube
# Importing the OS module for accessing system functionality
# 'getlogin' gives the username of the user who is logged in currently
# 'remove' to delete the junk files from the system to free up space
from os import remove,getlogin
# Importing the platform module to identify the type of system on which the program is being used.
from platform import system
def get_video_info(url):
@utgupta27
utgupta27 / snap-update.txt
Last active July 7, 2021 12:10
To Resume or Pause the Snapd from auto updating Snap-Packages
Only for Snap-Packages.
Stop auto-update:
$sudo snap set system refresh.metered=hold
(After executing the above command, toggle-on the Metered Wifi Connection)
Resume auto-update:
$sudo snap set system refresh.metered=null
(After executing the above command, toggle-of the Metered Wifi Connection)