Skip to content

Instantly share code, notes, and snippets.

Avatar
😉

Maher El Gamil maherelgamil

😉
View GitHub Profile
@maherelgamil
maherelgamil / getAllUrlParams.js
Created Feb 24, 2019
Getting a URL Parameter with javascript
View getAllUrlParams.js
function getAllUrlParams(url) {
// get query string from url (optional) or window
var queryString = url ? url.split('?')[1] : window.location.search.slice(1);
// we'll store the parameters here
var obj = {};
// if query string exists
if (queryString) {
@maherelgamil
maherelgamil / generate-ssh-key.sh
Created Feb 13, 2019 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
View generate-ssh-key.sh
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@maherelgamil
maherelgamil / PowerShell Customization.md
Created Feb 8, 2019 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization
View PowerShell Customization.md

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

View git automatic tagging
#!/bin/sh
# This script will be executed after commit in placed in .git/hooks/post-commit
# Semantic Versioning 2.0.0 guideline
#
# Given a version number MAJOR.MINOR.PATCH, increment the:
# MAJOR version when you make incompatible API changes,
# MINOR version when you add functionality in a backwards-compatible manner, and
# PATCH version when you make backwards-compatible bug fixes.
@maherelgamil
maherelgamil / Readme.md
Last active Sep 3, 2018
[Create nginx server block] #nginx #server #linux #ubuntu
View Readme.md

Here’s what it does, in a nutshell:

  • Creates a new directory for the site (/var/www/DOMAIN.COM/public_html)
  • Creates a new directory for log files (/var/www/DOMAIN.COM/logs)
  • Sets correct owner/group.
  • Creates a simple index.html file to show the site is working.
  • Asks for restart.

To use the script type:

@maherelgamil
maherelgamil / install.sh
Last active Sep 3, 2018
[VPS install bash script for Ubuntu 16.04] #ubuntu #linux #server #vps
View install.sh
# =================== YOUR DATA ========================
SERVER_NAME="some-server-name"
SERVER_IP="111.111.11.11"
USER="someuser"
SUDO_PASSWORD="secret-password-one"
MYSQL_ROOT_PASSWORD="secret-password-two"
@maherelgamil
maherelgamil / slugify.js
Last active Sep 3, 2018 — forked from Omranic/slugify.js
[Slugify] Converts a string to a "URL-safe" slug. #javascript
View slugify.js
/**
* Converts a string to a "URL-safe" slug.
* Allows for some customization with two optional parameters:
*
* @param {string} Delimiter used. If not specified, defaults to a dash "-"
* @param {array} Adds to the list of non-alphanumeric characters which
* will be converted to the delimiter. The default list includes:
* ['–', '—', '―', '~', '\\', '/', '|', '+', '\'', '‘', '’', ' ']
*/
if (!String.prototype.slugify) {