Skip to content

Instantly share code, notes, and snippets.

hbspt.forms.create({
region: "na1",
portalId: "19646847",
formId: "dcc34642-805c-4d18-890f-6d8a74d000cf"
});
@jyotendra
jyotendra / schema_drop.sql
Created May 25, 2021 07:47
This sql script helps to drop entire scema from a database
SET FOREIGN_KEY_CHECKS = 0;
SET SESSION group_concat_max_len = 1000000;
SET @TABLES = NULL;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name,'`') INTO @TABLES FROM information_schema.tables
WHERE table_schema = 'databaseName';
SET @TABLES = CONCAT('DROP TABLE IF EXISTS ', @TABLES);
PREPARE stmt FROM @TABLES;
@jyotendra
jyotendra / nginx.conf
Created May 16, 2021 18:10
proxy server with for port 3000 with ssl enabled
GNU nano 4.8 metabase.com # sample nginx.conf
# proxy requests to Metabase instance
server {
listen 80;
listen [::]:80;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/metabase.covidindiaresources.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/metabase.covidindiaresources.com/privkey.pem;
import { ajax } from 'rxjs/ajax';
// action creators
const fetchUser = username => ({ type: FETCH_USER, payload: username });
const fetchUserFulfilled = payload => ({ type: FETCH_USER_FULFILLED, payload });
// epic
const fetchUserEpic = action$ => action$.pipe(
ofType(FETCH_USER),
mergeMap(action =>
@jyotendra
jyotendra / arduino_counter.ino
Created November 12, 2019 02:48
Demonstration of receiving data from arduino via python
int count=0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
while(1)
@jyotendra
jyotendra / publisher.py
Created November 12, 2019 02:29
This gist demonstrates a simple-publisher and a simple-subscriber
import paho.mqtt.publish as publish
publish.single("bv_solutions/test", "payload", hostname="mqtt.eclipse.org")
@jyotendra
jyotendra / ff_serialiser.py
Created October 15, 2019 10:04
This gist describes serialising a video, frame by frame, and then reconstructing the image using opencv and ffmpeg
import subprocess as sp
import cv2 as cv
import numpy as np
import ffmpeg
probe = ffmpeg.probe('/home/jyotendra/Videos/pandas.mp4')
video_info = next(s for s in probe['streams'] if s['codec_type'] == 'video')
width = int(video_info['width'])
height = int(video_info['height'])
num_frames = int(video_info['nb_frames'])
@jyotendra
jyotendra / string_splitter_printer.py
Created September 16, 2019 10:10
LSTM string splitter script
# | diving 42.6% | accident 79.7% | collapsing 79.9%
def splitter(text, threshold):
text = text.strip()
text = text.split("|")
new_text_array = []
for txt in text:
txt = txt.strip()
if txt == '':
continue
@jyotendra
jyotendra / annotations_corrector.py
Created August 1, 2019 10:39
This script corrects path of voc annotations to new one -- when the files are transferred to another system
import glob, os
import argparse
import xml.etree.ElementTree as ET
import ntpath
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--images", required=True, help="enter path where images are stored")
parser.add_argument("-l", "--labels", required=True, help="enter path where labels are stored")
@jyotendra
jyotendra / settings.json
Created April 25, 2019 12:31
licenser vs code plugin license file. To be kept inside .vscode
{
"licenser.license": "Custom",
"licenser.author": "Jyotendra Sharma",
"licenser.projectName": "SignalRApp",
"licenser.useSingleLineStyle": false,
"licenser.customHeader": "@FILE@ - @PROJECT@\r\nCopyright @YEAR@ - Bitvivid Solutions Pvt. Ltd. \r\n*********************************************************\r\nAuthor - @AUTHOR@ \r\n*********************************************************\r\nNo part of this software may be copied or distributed without written consent from Bitvivid Solutions Pvt. Ltd (company).\r\nThe company holds right to prosecute the individual\/organisation\/company found guilty of misusing company's intellectual properties."
}