Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View manashmandal's full-sized avatar
👨‍💻
Probably Coding || ! Probably Coding

Manash Kumar Mandal manashmandal

👨‍💻
Probably Coding || ! Probably Coding
View GitHub Profile
@manashmandal
manashmandal / index.js
Created April 27, 2020 11:54
Concurrent Requests Using NodeJs
const axios = require("axios");
const endpoint = "https://randomuser.me/api";
const totalRequests = 20;
(async () => {
let requests = [];
for (let i = 0; i < totalRequests; i++) {
requests.push(axios.get(endpoint));
}
Promise.all(requests)
.then((responses) => {
[
{
"Name": "chevrolet chevelle malibu",
"Miles_per_Gallon": 18,
"Cylinders": 8,
"Displacement": 307,
"Horsepower": 130,
"Weight_in_lbs": 3504,
"Acceleration": 12,
"Year": "1970-01-01",
@manashmandal
manashmandal / self_ngrok.sh
Created February 11, 2020 06:47
self hosted ngrok
ssh -i key.pem -R remote_open_port:localhost:local_open_port user@domain
@manashmandal
manashmandal / variable_rnn_torch.py
Created February 10, 2020 10:21 — forked from dolaameng/variable_rnn_torch.py
Variable Length Sequence for RNN in pytorch Example
import torch
import torch.nn as nn
from torch.autograd import Variable
batch_size = 3
max_length = 3
hidden_size = 2
n_layers =1
# container
sudo apt-get install -y python3.8 python3.8-dev
rm -rf /app/tradingbot/venv
cd /app/tradingbot
virtualenv venv --python /usr/bin/python3.8
@manashmandal
manashmandal / script.sh
Created August 22, 2019 09:35
Bash hacks
# Change extension of files
for f in $(ls); do mv $f $(echo $f | cut -d "." -f 1).jpeg ; done
# Day 0: Mean, Median, and Mode
# Selecting standard input
con <- file('stdin', open='r')
# We don't need the first input
data_line <- readLines(con)[[2]]
# splitting the data into individual string
split_data <- strsplit(data_line, " ")
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "jsmn.h"
#define JSON_FILE_PATH "../Parser/test.json"
#define BUFFER_SIZE 5000
#define MAX_TOKEN_COUNT 128
// Read files
@manashmandal
manashmandal / build_opencv_ARM_cross
Created October 15, 2017 10:51 — forked from hrshovon/build_opencv_ARM_cross
Cross compile opencv3.3.0 for your raspberry pi and similar ARM devices with python support
This is a note on how to cross compile opencv for pretty much any ARM device(HardFP supported in this case) and deploy. Native
compiling in ARM devices can be painfully slow and they seem to hang often during build(mine got stuck at 43%). So if you happen
to have a desktop/laptop/server running ubuntu or similar linux distro, u can build opencv in fractionth of the time taken for
native compiling without any issues.
Building opencv3 with TBB and NEON and VFP support can boost opencv performance. Thanks to Adrian at pyimagesearch for pointing that out.
Both my PC and target machine aka orange pi zero are running ubuntu 16.04 with python2.7 and python 3.5.
1.Run the following commands in both machines to install the necessary libraries etc.(mine worked with them,so they should be enough
hopefully)
sudo apt-get update && sudo apt-get upgrade
def build_deep_autoencoder(img_shape,code_size=32):
"""PCA's deeper brother. See instructions above"""
H,W,C = img_shape
encoder = keras.models.Sequential()
encoder.add(L.InputLayer(img_shape))
encoder.add(L.Flatten())
encoder.add(L.Dense(code_size*8, activation='relu'))
encoder.add(L.Dense(code_size*4, activation='tanh'))