Skip to content

Instantly share code, notes, and snippets.

View mirajehossain's full-sized avatar
💣

Md. Alamin (Miraje) mirajehossain

💣
View GitHub Profile
let arr = [1,2,3,4,5];
/// with initial value
let result = arr.reduce((accumulator,currentValue,currentIndex,array)=>{
console.log(`result: ${accumulator}, current value: ${currentValue}, index: ${currentIndex}, array: ${array} `);
return accumulator + currentValue;
},0);
///OUTUT:
result: 0, current value: 1, index: 0, array: 1,2,3,4,5
result: 1, current value: 2, index: 1, array: 1,2,3,4,5
result: 3, current value: 3, index: 2, array: 1,2,3,4,5
let persons = [
{ name: 'John', age: 25, gender: 'male'},
{ name: 'Doe', age: 35, gender: 'male'},
{ name: 'Nayla',age: 18, gender: 'female'},
{ name: 'Alex', age: 21, gender: 'female'},
{ name: 'Jane', age: 22, gender: 'male'}
];
let age = persons.filter((person)=>{
return person.gender === 'male';
const express = require('express');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const multer = require('multer');
const index = require('./routes/index');
const app = express();
/*
{
"status": true,
"message": "Message",
"statusCode": 200,
"data": {
"access_token": "mytoken here"
}
}
*/
import 'dart:async';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:flutter_sqflite_app/model/user.model.dart';
class ApiService {
static final BASE_URL = "https://xxxxxxxx.herokuapp.com";
static final LOGIN_URL = BASE_URL + "/auth/v1/users/login";
@mirajehossain
mirajehossain / html5-video-streamer.js
Created January 7, 2019 09:36 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
#install mongodb
# Step 1 - Import the public key used by the package management system
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 68818C72E52529D4
# Step 2 - Create source list file MongoDB
#Create a MongoDB list file in /etc/apt/sources.list.d/ with this command:
{
"board": [{
"title": "Barisal board",
"boardDistricts": {
"districts": [
{
"title": "Barisal",
"thana": ["Muladi Upazila", "Babuganj Upazila", "Agailjhara Upazila", "Barisal Sadar Upazila", "Bakerganj Upazila", "Banaripara Upazila", "Gaurnadi Upazila", "Hizla Upazila", "Mehendiganj Upazila", "Wazirpur Upazila"]
},
{
@mirajehossain
mirajehossain / otpverify.js
Created October 5, 2019 17:16 — forked from theanam/otpverify.js
OTP verification without database, full sample source code
const otpGenerator = require("otp-generator");
const crypto = require("crypto");
const key = "verysecretkey"; // Key for cryptograpy. Keep it secret
function createNewOTP(phone){
// Generate a 6 digit numeric OTP
const otp = otpGenerator.generate(6, {alphabets: false, upperCase: false, specialChars: false});
const ttl = 5 * 60 * 1000; //5 Minutes in miliseconds
const expires = Date.now() + ttl; //timestamp to 5 minutes in the future
const data = `${phone}.${otp}.${expires}`; // phone.otp.expiry_timestamp
@mirajehossain
mirajehossain / ubuntu-server-hardening.md
Last active March 15, 2026 17:57
ubuntu-server-hardening checklist

Ubuntu-Server-Hardening

1. Secure Shared Memory

What is shared memory?

Shared memory is an efficient means of passing data between programs. Because two or more processes can use the same memory space, it has been discovered that, since shared memory is, by default, mounted as read/write, the /run/shm space can be easily exploited. That translates to a weakened state of security.

If you’re unaware, shared memory can be used in an attack against a running service. Because of this, you’ll want to secure that portion of system memory.