Skip to content

Instantly share code, notes, and snippets.

View ronakjain2012's full-sized avatar

Ronak Bokaria ronakjain2012

View GitHub Profile
@ronakjain2012
ronakjain2012 / Snippets.MD
Last active February 16, 2024 12:24
Python Snippets

Python Snippets

@ronakjain2012
ronakjain2012 / mysql_python.py
Created February 10, 2024 18:14
MySQL and Python the easy way single script
# require: pip3 install mysql-connector-python
import mysql.connector
class MySQLManager:
def __init__(self, host, user, passwd, database, port=3306):
self.mydb = mysql.connector.connect(
host=host,
user=user,
passwd=passwd,
database=database,
@ronakjain2012
ronakjain2012 / find_ports.py
Created February 10, 2024 16:57
Find available ports using python script from command line.
import socket
import sys
def find_available_ports(start_port, end_port):
available_ports = []
for port in range(start_port, end_port+1):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
# Set a timeout for trying to bind to a port
s.settimeout(1)
try:
@ronakjain2012
ronakjain2012 / kill_process_pid.sh
Created February 10, 2024 16:36
Kill the process by process id script
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'Usage: ./$0 <port> <port> <port> ...'
exit 0
fi
cnt=0
for port in $@; do
while :; do
[{"value":"01001 – Growing and manufacturing of tea","label":"01001 – Growing and manufacturing of tea"},{"value":"01002 – Growing and manufacturing of coffee","label":"01002 – Growing and manufacturing of coffee"},{"value":"01003 – Growing and manufacturing of rubber","label":"01003 – Growing and manufacturing of rubber"},{"value":"01004 – Market gardening and horticulture specialties","label":"01004 – Market gardening and horticulture specialties"},{"value":"01005 – Raising of silk worms and production of silk","label":"01005 – Raising of silk worms and production of silk"},{"value":"01006 – Raising of bees and production of honey","label":"01006 – Raising of bees and production of honey"},{"value":"01007 – Raising of poultry and production of eggs","label":"01007 – Raising of poultry and production of eggs"},{"value":"01008 – Rearing of sheep and production of wool","label":"01008 – Rearing of sheep and production of wool"},{"value":"01009 – Rearing of animals and production of animal products","label":"01
@ronakjain2012
ronakjain2012 / friends.js
Last active August 11, 2023 06:41
Remove Friends New UI
async function removeFriends(unfriendTotal, removeFriendName) {
const delay = (delayInms) => {
return new Promise(resolve => setTimeout(resolve, delayInms));
}
async function un() {
try {
let nodes = []
// $('.x6s0dn4.x78zum5.x1q0g3np div[aria-label="More"]').click()
if ($('div.xb57i2i .x4k7w5x.x1h91t0o.x1beo9mf.xaigb6o.x12ejxvf.x3igimt.xarpa2k.xedcshv.x1lytzrv.x1t2pt76.x7ja8zs.x1n2onr6.x1qrby5j.x1jfb8zj')) {
@ronakjain2012
ronakjain2012 / Ternary Binary Tree.js
Created August 1, 2022 17:31
Ternary Binary Tree Implementation in JavaScript
class Node {
constructor(char) {
this.char = char;
this.right = this.left = this.middle = this.eow = null;
}
}
class TST {
constructor() {
this.root = null;
@ronakjain2012
ronakjain2012 / countries.json
Created October 21, 2021 03:55
Country JSON to use in projects, contries json covers 250 countires and their details like callingcode flag region latlng
/* 1 */
{
"code" : "AF",
"name" : "Afghanistan",
"status" : false,
"borders" : null,
"callingCodes" : [
"93"
],
"capital" : "Kabul",
@ronakjain2012
ronakjain2012 / get_table_cols_scrapping.js
Created April 25, 2020 12:48
Get table cols by scraping phpmyadmin "Propose table structure" link
let arr = [];
$('*[data-uniqueid="637612369"] tr').each((e,i)=>{ if($(i).hasClass("even") || $(i).hasClass("odd")) { var l = ($(i).children('td:first').text().split('.')).length; var ll = $(i).children('td:first').text().split('.')[l-1]; arr.push(ll); } })
console.log(arr);
// run all lines sapratlly
@ronakjain2012
ronakjain2012 / cloudSettings
Last active July 23, 2019 05:27
VS Code Setting
{"lastUpload":"2019-07-23T05:27:49.714Z","extensionVersion":"v3.4.1"}