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 / ip_to_dns.sh
Created November 16, 2021 02:49
CTF: Ping & get DNS name from a list of IPs saved in a file
#!/bin/zsh
#Ping & get DNS name from a list of IPs saved in a file
#Prompt the user to enter a file name and its path.
read -p "Enter the IP addresses file name / path:" FILE_PATH_NAME
function check_host(){
#if not the IP address value is empty
if [[ -n $IP_ADDRESS ]]
@dhruvilp
dhruvilp / main.dart
Created October 12, 2021 03:45
Flutter "Link" widget
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@dhruvilp
dhruvilp / html_parser.py
Created September 19, 2021 02:57
HTML Parser for DB2 Responses
from html.parser import HTMLParser
from html.entities import name2codepoint
keys = []
values = []
dataTypes = ["CHAR","VARCHAR","BOOL","BOOLEAN","SMALLINT","INT","INTEGER","DOUBLE","DECIMAL","DATE","DATETIME","TIMESTAMP"]
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
@dhruvilp
dhruvilp / EntityVarGenerator.java
Created September 16, 2021 17:57
Entity Variable Def Generator
import java.util.*;
import java.util.stream.*;
public class Main {
public static String dromedaryCamelCase(String inputStr) {
String bactrianCamel = Stream.of(inputStr.split("[^a-zA-Z0-9]")).filter(x -> x.length() > 0).map(v -> v.substring(0, 1).toUpperCase() + v.substring(1).toLowerCase()) .collect(Collectors.joining());
return bactrianCamel.toLowerCase().substring(0, 1) + bactrianCamel.substring(1);
}
@dhruvilp
dhruvilp / UseHistoryExample.jsx
Created August 16, 2021 23:23
React useHistory hook example
import React from "react";
import { BrowserRouter as Router,
Switch, Route, Link, useHistory} from "react-router-dom";
export default function BasicExample() {
return (
<Router>
<div>
<Switch>
<Route exact path="/">
@dhruvilp
dhruvilp / main.dart
Created July 10, 2021 04:44
Elevated Buttons - Flutter
/// Flutter code sample for SwitchListTile
// ![SwitchListTile sample](https://flutter.github.io/assets-for-api-docs/assets/material/switch_list_tile.png)
//
// This widget shows a switch that, when toggled, changes the state of a [bool]
// member field called `_lights`.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
@dhruvilp
dhruvilp / theme.txt
Created July 6, 2021 16:33
IntelliJ Themes
https://github.com/darekkay/config-files/blob/master/intellij-idea/config/colors/tomorrow-evening.icls
https://github.com/darekkay/config-files/blob/master/intellij-idea/config/colors/dk-monokai.icls
@dhruvilp
dhruvilp / main.dart
Created July 3, 2021 00:42
Get Current URL Query Parameters, Host Info, etc
import 'dart:html';
void main() {
// Uri uri = Uri.parse('https://www.example.com:3000/fruit?q=yellow');
Uri uri = Uri.parse(window.location.href);
print('Authority: '+uri.authority);
print('Fragment: '+uri.fragment);
print('Host: '+uri.host);
@dhruvilp
dhruvilp / main.dart
Last active June 29, 2021 22:45
Web Scroll View
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override