Skip to content

Instantly share code, notes, and snippets.

Ibrahim Mohamed albarki

  • Egypt
Block or report user

Report or block albarki

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
albarki /
Last active Jun 25, 2018 — forked from fduran/gist:1870429
Linux disk space email alert
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX
# adapt these 3 parameters to your case
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
if [ $USE -gt $MAX ]; then
albarki /
Created Jun 4, 2018 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
albarki / .htaccess
Created Jun 4, 2018 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php
#Redirect an entire site:
Redirect 301 /
#Redirect an entire site to a sub folder
Redirect 301 /
albarki /
Created Jun 3, 2018 — forked from trentmswanson/
Linux bash script to partition and format all data disks in azure
# An set of disks to ignore from partitioning and formatting
# Base directory to hold the data* files
usage() {
echo "Usage: $(basename $0) <new disk>"
albarki / sidekiq.service
Created Jun 1, 2018 — forked from mkhuda/sidekiq.service
Sidekiq service auto start for Ubuntu 16.04 using Systemd
View sidekiq.service
# Sidekiq auto start using systemd unit file for Ubuntu 16.04
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
albarki /
Created May 16, 2018 — forked from mikhailov/
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist
$ cd /usr/src
$ wget
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget
albarki /
Created May 11, 2018 — forked from junaidk/
Get List of EC2 instances from All regions
# install aws cli first
for region in `aws ec2 describe-regions --output text | cut -f3`
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --query "Reservations[*].Instances[*].{IP:PublicIpAddress,ID:InstanceId,Type:InstanceType,State:State.Name,Name:Tags[0].Value}" --output=table --region $region
You can’t perform that action at this time.