Skip to content

Instantly share code, notes, and snippets.

View shubham7298's full-sized avatar
:octocat:
On a coding spree

Shubham Singh shubham7298

:octocat:
On a coding spree
View GitHub Profile
@shubham7298
shubham7298 / instructions.md
Created January 25, 2021 05:40
Uninstalling rails completely
  1. Check the rails version:

rails -v

  1. Uninstall rails or a specific version of it.

gem uninstall rails -v 4.1.16

or
@shubham7298
shubham7298 / model.js
Created October 24, 2020 14:09
children schema in mongoose
const mongoose = require('mongoose');
const Schema = mongoose.Schema,
model = mongoose.model.bind(mongoose),
ObjectId = mongoose.Schema.Types.ObjectId;
const slotSchema = new Schema ({
slot_time: String,
slot_date: String,
from flask import Flask, request
from pymongo import MongoClient
from flask_cors import CORS, cross_origin
# import cloudinary
# import cloudinary.uploader
# import cloudinary.api
import json
# from smsSender import send_sms
app = Flask(__name__)
@shubham7298
shubham7298 / https.js
Last active April 4, 2020 20:19
HTTP/HTTPS Proxy server
const net = require('net');
const server = net.createServer();
const PORT = 9000;
// Emitted when an error occurs. The 'close' event will be called directly following this event.
server.on('error', (err) => {
console.log('Error');
console.log(err);
});
@shubham7298
shubham7298 / virtual.cpp
Created February 11, 2020 13:37
Virtual functions in C++
#include <iostream>
using namespace std;
class Base {
public:
void f1() {
cout<<"f1 from base class\n";
}
void f2() {
@shubham7298
shubham7298 / increase-body-limit.js
Created July 3, 2019 06:23 — forked from Maqsim/413-payload-too-large-fix.js
When you face an error 413 Payload too large in NodeJS, use this to fix that out
const express = require('express');
const bodyParser = require('body-parser');
...
// Express 4.0
app.use(bodyParser.json({ limit: '10mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
// Express 3.0
@shubham7298
shubham7298 / server.c
Created June 27, 2019 19:24
Build a server socket in C
#include <stdio.h> // io
#include<sys/types.h> // def. of datatypes used in system calls
#include<sys/socket.h> // def. of structures needed for socket
#include<netinet/in.h> // constants and addr. needed for internet domain addr.
// this func is called when a system call fails
void error(char *msg)
{
perror(msg);
exit(1);
@shubham7298
shubham7298 / navbeer.html
Last active February 24, 2019 13:38
cool navbar arrowed
<!DOCTYPE html>
<html>
<head>
<title>Nav</title>
<style type="text/css">
.nav-pills.nav-wizard > li {
position: relative;
overflow: visible;
display: inline-block;
border-right: 15px solid transparent;
@shubham7298
shubham7298 / index.html
Created February 22, 2019 11:01
BLE Eddystone scanners
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no
initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<title>Sahayak</title>
<script>
import cv2
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy.spatial import distance
folder='cats'
f=os.listdir(folder)
cats=[]