Skip to content

Instantly share code, notes, and snippets.

View sh4hids's full-sized avatar
🤔
nothing special I guess

Shahidul Islam Majumder sh4hids

🤔
nothing special I guess
View GitHub Profile
@sh4hids
sh4hids / install-docker.sh
Created December 16, 2021 06:54 — forked from madkoding/install-docker-deepin.sh
Install Docker-CE script for Deepin Linux
#!/bin/sh
# Shell script to add docker-ce to Deepin Linux repositories
# Remove old docker
sudo apt-get remove -y docker docker-engine docker.io containerd runc
# Install dependencies
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
@sh4hids
sh4hids / aws-couchdb-setup.md
Created September 15, 2021 05:57 — forked from Ravenstine/aws-couchdb-setup.md
Fast CouchDB setup in AWS

Fast CouchDB setup in AWS

CouchDB is a NoSQL database for storing JSON documents. It comes with a REST API out of the box so your client applications can persist data while requiring you to write little or no server-side code. CouchDB's killer feature is its ability to easily replicate, which allows for horizontal scaling, easy backup, and for client adapters to synchronize documents. This is perfect if you want to write an application that is offline-first. It's become my go-to database when creating new

@sh4hids
sh4hids / javascript-remove-accents.js
Created August 21, 2020 11:38 — forked from marcelo-ribeiro/javascript-remove-accents.js
An Javascript function to remove accents, spaces and set lower case from an input string.
function slugify (str) {
var map = {
'-' : ' ',
'-' : '_',
'a' : 'á|à|ã|â|À|Á|Ã|Â',
'e' : 'é|è|ê|É|È|Ê',
'i' : 'í|ì|î|Í|Ì|Î',
'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ',
'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü',
'c' : 'ç|Ç',
function generateBaklava(length = 1){
let l = (length * 2) + 1;
for(let i = 0; i < l; i++){
let str = '';
for(let j = 0; j < l; j++){
if (i <= l/2) {
if(j >= parseInt(l/2, 10) - i && j <= parseInt(l/2, 10) + i ) {
str += "*";
} else {
@sh4hids
sh4hids / install.sh
Created April 28, 2019 05:55 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@sh4hids
sh4hids / customizing-vs-code.md
Created June 30, 2018 14:05 — forked from nickytonline/customizing-vs-code.md
Customizing VS Code for Two Fonts.

Customizing VS Code

I followed the instructions in this blog post Multiple Fonts: Alternative to Operator Mono in VSCode, but did not see any changes made to VS Code. After digging a bit, I discovered that all the CSS class names had changed. They’re now e.g. .mtk13, .mtk16 { … }.

Gotchas

  • Ensure it’s a file URL e.g. { "vscode_custom_css.imports": [ "file:///Users/Brian/Desktop/vscode-style.css" ] }
  • If you move the location of your file and update your user settings with the new location, you will need to disable and enable custom CSS cmd+shift+p.
  • Also, anytime you change the style in your custom CSS file, you need to disable, then re-enable the extension.

For reference

@sh4hids
sh4hids / ExpressJS Project Structure
Last active March 11, 2018 15:24
Feature based project structure for Express Application
xpress-app
|-- 📁 bin
| |-- www
|-- 📁 config
| |-- config.js
| |-- db.js
| |-- api.version.js
|-- 📁 helpers
| |-- 📁 auth
| |-- 📁 chat
@sh4hids
sh4hids / renameFilesInFolder.js
Created March 7, 2018 15:36
Rename all the files in a directory with NodeJS
const fs = require('fs');
const path = require('path');
const dirPath = path.join(__dirname, './dir/relative/path');
fs.readdir(dirPath, (err, files) => {
let x = 1;
files.forEach((file) => {
let oldPath = path.join(dirPath,file);
let newPath = path.join(dirPath,`filename${x}.extension`);