Skip to content

Instantly share code, notes, and snippets.

View kamal-hossain's full-sized avatar
👉

Kamal kamal-hossain

👉
View GitHub Profile
@kamal-hossain
kamal-hossain / server.js
Created September 23, 2021 10:21
Image download, crop and convert to base64 in Nodejs
const express = require('express')
const imageToBase64 = require('image-to-base64')
const app = express()
const fs = require('fs')
const Axios = require('axios')
const sharp = require('sharp')
app.use(express.json())
app.use((r, res, next) => {
@kamal-hossain
kamal-hossain / test_server.js
Last active November 15, 2021 04:22
Nodejs sever without express
require("http").createServer(function(request, response){
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World!");
response.end();
}).listen(8080);
@kamal-hossain
kamal-hossain / ssh.md
Last active July 20, 2021 05:02 — forked from bradtraversy/ssh.md
SSH Snippets

SSH Cheat Sheet

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Login via SSH with key (remote server)

ssh -i "react-counter-app.pem" ubuntu@test.compute.amazonaws.com

Logout from SSH

$ logout

@kamal-hossain
kamal-hossain / readme.md
Last active September 14, 2021 00:40
Advance google search techniques

Advance google search techniques

  • Search by asterics for all keywords
the capital of *
  • Search within the website
kamalhossain.me javascript

TypeScript debugging in vscode

  • Add brekpoint in TypeScript file to inspect via vscode debugger and Debugger for Chrome
    • Install Debugger for Chrome extension in vscode
    • F9 to add breakpoint
    • Set "sourceMap": true, in tsconfig.json
    • Go to Run > Start Debugging
    • Select environment Chrome (it won't appear with chrome extention)
    • In launch.json file set url to specefic port where developemnt server is running e.g. (http://localhost:3000)
  • Make sure webRoot is correct
@kamal-hossain
kamal-hossain / browser-tab-broadcast-react.js
Last active December 28, 2020 03:42
Share data between react app in browser tabs ( must be same protocol, origin and port) , https://dev.to/kamalhossain/send-data-between-tabs-in-react-app-2ehi
import React from 'react'
import './App.css'
function App() {
const [isOpnnedAlready, setIsOpnnedAlready] = React.useState(false)
const channel = React.useMemo(() => new BroadcastChannel('couldBeAnything'), [])
React.useEffect(() => {
channel.postMessage({
@kamal-hossain
kamal-hossain / mongodb_cheat_sheet.md
Last active September 4, 2021 01:25 — forked from bradtraversy/mongodb_cheat_sheet.md
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Open MongoDB in cmd (For windows)

mongo

If mongo is not recognized as an internal or external command, operable program or batch file, then do the followings from this blog

Show All Databases

@kamal-hossain
kamal-hossain / README.md
Last active January 3, 2021 08:56
Download these in the directory from where you want to download all files. Install express & ejs.

Simple server for download all files from the parent directory (Windows 10 tested)

Follow the instructions:

  • Download all files from the gist to the target folder, from where you want to make all files make avaiable for download
  • Install the 'express' & 'ejs'
  • start the server.js with node
  • visit link: http://localhost:3000/
@kamal-hossain
kamal-hossain / README.md
Last active September 11, 2021 02:19
Express js node js server

Simple web server for ndoejs, using Express.