Skip to content

Instantly share code, notes, and snippets.

View msudgh's full-sized avatar

Masoud Ghorbani msudgh

View GitHub Profile
#!/bin/bash
list_of_tz=(America/New_York Asia/Tehran Europe/Malta Europe/Mardrid Asia/Kolkata Europe/Vilnius)
RED=$(tput setaf 1) GREEN=$(tput setaf 2)
for i in ${list_of_tz[@]}; do
timezone="${GREEN}${i}:"
date="$RED $(TZ=$i date)"
echo $timezone $date
...
frontend redis_gate
bind 127.0.0.1:5000 name redis
default_backend redis_servers
maxconn 1024
backend redis_servers
balance roundrobin
option tcp-check
@msudgh
msudgh / zipper.sh
Last active June 7, 2018 07:18
Compress the files and exclude the gitignore file lines
#!/bin/bash
# --------------------------------------------------------------
# [Author] Masoud Ghorbani (@msudgh)
# [Created] June 8, 2017
# [Description] Compress the files and exclude the gitignore file lines
# --------------------------------------------------------------
# Define the source file that represent the files to be exclude
file=.gitignore
@msudgh
msudgh / detectENV.js
Last active December 27, 2016 12:15
A module to detect the environment of the scripts is running
/**
*
* An module to detect the environment of the scripts is running.
* if the value of the module was true, the script is running on browser environment otherwise it's on Node.js
*
* @returns {boolean} - return a boolean object
*
* @example - import the module in your scripts and just call it.
* let detectENV = require('./detectENV.js')
*
@msudgh
msudgh / english-farsi-converter.js
Last active December 26, 2016 19:24
Converting English & Farsi digits
function toFarsiDigit(number) {
const regex = /[0-9]/g
let result = number.replace(regex, function (w) {
return String.fromCharCode(w.charCodeAt(0) + 1728)
})
return result
}
function toEnglishDigit(number) {