Skip to content

Instantly share code, notes, and snippets.

View dhruvilp's full-sized avatar
๐Ÿ’ญ
๐Ÿ‘จโ€๐Ÿ’ป working on something really cool

Dhruvil Patel dhruvilp

๐Ÿ’ญ
๐Ÿ‘จโ€๐Ÿ’ป working on something really cool
View GitHub Profile
@dhruvilp
dhruvilp / secure.md
Last active April 1, 2023 20:52
Flutter OWASP top 10 & security checks
  1. Improper platform usage: ask for permissions to use on-device resources (ex: camera, location)
  2. Secure storage: pub pkg -- flutter_secure_storage, hive, secure_application
  3. Insecure communication: http_certificate_pinning, ssl_pinning_plugin (ssl/tsl cert based)
  4. Insecure authentication: local_auth
  5. Insufficient cryptography: only use NIST approved encryption algos encrypt, crypto
  6. Insecure authorization
  7. Client code quality checks - vulnerability/maintainability checks (static and dynamic security checks)
  8. Code tempering: flutter_jailbreak_detection
  9. Reverse engineering: check if IDA Pro & Hopper can de-obfuscate your code; use --obfuscate while building a flutter app, also use binary build which are hard to decompile
  10. Extraneous functionality: check logs for info leaks about backend or any silly hard-coding PI data. Use RASP (runtime analysis self-protection) freerasp pkg to check against security leaks
@dhruvilp
dhruvilp / team-form.py
Last active April 3, 2023 23:01
Team formation
import random
participants = [i for i in range (1,41)]
random.shuffle(participants)
groups = [participants[i:i+4] for i in range(0, len(participants), 4)]
for i in range(len(groups)):
print(f"Group {i+1}: {groups[I]}")
@dhruvilp
dhruvilp / remove-consoles.js
Created February 23, 2023 22:06
React remove console.log across the app
export const GlobalDebug = (function () {
var savedConsole = console;
/**
* @param {boolean} debugOn
* @param {boolean} suppressAll
*/
return function (debugOn, suppressAll) {
var suppress = suppressAll || false;
if (debugOn === false) {
// supress the default console functionality
@dhruvilp
dhruvilp / maint.dart
Created January 23, 2023 02:56
Flutter Responsive Layout App
import 'package:flutter/material.dart';
var defaultBackgroundColor = Colors.grey[300];
var appBarColor = Colors.grey[900];
var myAppBar = AppBar(
backgroundColor: appBarColor,
title: const Text(' '),
centerTitle: false,
);
var drawerTextColor = TextStyle(
@dhruvilp
dhruvilp / main.dart
Created January 18, 2023 21:42
Parallax effect for landing page
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@dhruvilp
dhruvilp / main.dart
Created January 2, 2023 05:37
Flutter SIngle Select Buttonnbar
import 'package:flutter/material.dart';
final List<Widget> buttons = <Widget>[
Row(
children: const [
Text('APPLE'),
SizedBox(width: 5),
Icon(Icons.sunny),
],
),
@dhruvilp
dhruvilp / main.dart
Created November 22, 2022 23:02
Dart JSON Pretty print
import 'dart:convert';
void main(List<String> arguments) async {
final jsonResponse = jsonDecode(
"JSON");
// final data = jsonResponse["sid_01"];
JsonEncoder encoder = JsonEncoder.withIndent(' ');
String prettyprint = encoder.convert(jsonResponse);
print(prettyprint);
@dhruvilp
dhruvilp / main.dart
Created October 22, 2022 04:17
Flutter: Custom Tab Bar Widget
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
static const String _title = 'Flutter Code Sample';
@override
@dhruvilp
dhruvilp / notes.md
Created July 25, 2022 15:14
System Design 101

Fundamentals of System Design

  • Introduction to System Design
  • The System Design Interview
  • How to Answer System Design Questions
  • System Design Principles
  • How to Answer Web Protocol Questions in a System Design Interview
  • How to Cover Load Balancing in a System Design Interview
  • How to Answer Questions About CDNs in a System Design Interview
  • How to Answer Questions About APIs in System Design Interviews
@dhruvilp
dhruvilp / attachment-retrieval.py
Last active July 22, 2022 22:16
retrieving-attachments-from-exchange-mailbox-using-python
# source: https://www.moh10ly.com/retrieving-attachments-from-exchange-mailbox-using-python/
from exchangelib import DELEGATE, IMPERSONATION, Account, Credentials, EWSDateTime, EWSTimeZone, Configuration, NTLM, GSSAPI, CalendarItem, Message, Mailbox, Attendee, Q, ExtendedProperty, FileAttachment, ItemAttachment, HTMLBody, Build, Version, FolderCollection
credentials = Credentials(username='moh10ly\info', password='PWD')
ews_url = 'https://mail.moh10ly.com/EWS/exchange.asmx'
ews_auth_type = 'NTLM'