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 / 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
@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 / Doubly_link_list.cpp
Created February 22, 2016 11:44
Doubly link list with header circular
@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')) {
[{"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 / 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 / vue-table.html
Created July 10, 2018 16:29
Vue JS Table with Vue-bootstrap in single HTML page with CDN
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>table</title>
<!-- Add this to <head> -->
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css"/>
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css"/>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<!-- Add this after vue.js -->