Skip to content

Instantly share code, notes, and snippets.

💭
writing code for spaceship :P

Md Eftakhairul Islam eftakhairul

💭
writing code for spaceship :P
Block or report user

Report or block eftakhairul

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View The Ultimate Bad Ass .bashrc File
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@eftakhairul
eftakhairul / ES5 class.js
Created Aug 29, 2019 — forked from apal21/ES5 class.js
Example for blog to show the difference between ES5 and ES6 javascript classes using inheritance and prototypes use cases.
View ES5 class.js
'use strict';
/**
* Person class.
*
* @constructor
* @param {String} name - name of a person.
* @param {Number} age - age of a person.
* @param {String} gender - gender of a person.
*/
@eftakhairul
eftakhairul / config.go
Created Jan 28, 2019 — forked from chazcheadle/config.go
Golang Viper config read into struct
View config.go
package main
import (
"fmt"
"github.com/spf13/viper"
)
// Create private data struct to hold config options.
type config struct {
@eftakhairul
eftakhairul / regexCheatsheet.js
Created Jan 15, 2019 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
View gist:6beee5b5aff76dc23df82e0f7ceb5276
const fileDownload = (req, res, next) => {
const requestedFileName = `${req.params.id}:${req.params.filename}`;
const filePath = path.join([req.app.get('basedir'), 'storage'].join('/') , requestedFileName);
if (!fileSystem.existsSync(filePath)) {
return res.status(403).send({error: 'FileNotExists'}).end();
}
const stat = fileSystem.statSync(filePath);
const filename = path.basename(filePath);
View golang_job_queue.md
@eftakhairul
eftakhairul / db_backup.sh
Last active Sep 14, 2018
Dump your db using bzip2 compression
View db_backup.sh
#!/bin/sh
# Creates database backups using mysqldump. It uses bzip2 for compression, and
# the filename of the dump is DB- and the current timestamp. The dumps are stored
# in ARCHIVE_DIR and bzip2 is called with nice to make it softer on the server.
ARCHIVE_DIR=~/backup
FILENAME=$(date '+%Y-%m-%d_%H:%M:%S')
USER=root
PASS=your_db_password
@eftakhairul
eftakhairul / LEMP-server
Last active Jul 10, 2017
Create lamp-server
View LEMP-server
#!/bin/sh
##################################################################################
# Bash script to install an LEMP stack plus tweaks. For Ubuntu based systems.
# Written by @eftakhairul from https://eftakahirul.com
#
#
# RUN: bash <(curl -s https://gist.githubusercontent.com/eftakhairul/74670f8ba96bcf6efcecb28f238aa3b7/raw/f43cc5deaac1bcc20657e6bd3a1455441c1795d6/LEMP-server)
###################################################################################
View iInheritance in ES5 through prototype
/**
* Account class (Parent class)
* @constructor
*/
var Account = function() {
this.amount = 0;
this.setAmount = function(amount) {
this.amount = amount;
@eftakhairul
eftakhairul / JS Inheritance Concept
Last active Apr 29, 2017
JS Inheritance Concept through prototype
View JS Inheritance Concept
/*
//Literal way
var car = {
color:'black',
make: 'Audi',
model: 'A5',
move: function() {
return 'It is moving';
},
You can’t perform that action at this time.