Skip to content

Instantly share code, notes, and snippets.

View alhoqbani's full-sized avatar

Hamoud Alhoqbani alhoqbani

View GitHub Profile

Udacity DAND Project 01

Outline:

  1. Collecting data from Udacity workspace:

An sql query was run to collect data from the database. The query was designed to join temps data from Riyadh city (My choice) and the global temps.

SELECT g.year, c.avg_temp AS riyadh_avg_temp, g.avg_temp AS global_avg_temp
FROM global_data g
@alhoqbani
alhoqbani / new-cert.sh
Last active September 26, 2018 10:36
Apache self-signed certificate for use in development.
#!/usr/bin/env bash
# Script to generate self-signed certificate to use with Apache in localhost.
# Author: Hamoud Alhoqbani
# For details: https://gist.github.com/alhoqbani/4635bdf31cb96d68193341e00556d846
[ $# -eq 0 ] && { echo "Usage: $0 domain"; exit 1; }
function print_info() {
printf "\033[0;32m$@\033[0m\n"
}
@alhoqbani
alhoqbani / README.md
Created July 4, 2018 10:51 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.
@alhoqbani
alhoqbani / clone-all-branches.md
Last active February 23, 2018 05:25
Clone a remote git repository with all branches and tags

Create a folder for the repo.

mkdir ~/Desktop/repo && cd ~/Desktop/repo

Clone the remote repo as a bare repository to .git directory insdie the repo directory.

git clone --bare [email protected]:user/repo.git .git # <-- notice the extra .git
@alhoqbani
alhoqbani / db_backup.sh
Last active November 15, 2017 02:27
Databases Backup using github
#!/bin/bash
# Author: Hamoud Alhoqbani
# Backup mysql database every day at 00:00
# crontab -e
# 0 0 * * * /bin/bash /home/user/db_backup/db_backup.sh /home/user/db_backup/cron.log 2>&1
# Update these variables to your linking.
CURRENT_TIME=$(date +"%Y-%m-%d %I:%M:%S")
DB_USER=
DB_PASS=
@alhoqbani
alhoqbani / aws-ebs-backup
Last active November 16, 2017 12:06
Scripts to automate aws ebs volums backups
#!/usr/bin/env bash
# Script to automate aws ebs volums backups
# It backups all ebs volumes in the defult region
# and deltes all snapshots that older than provided age
# source: https://linuxacademy.com/cp/nuggets/view/id/78
ACTION=$1 # backup or delete
AGE=$2 # age of backups to delete in days
@alhoqbani
alhoqbani / post-receive
Last active September 19, 2018 20:17
post-receive Git hook to automate deployment after push to the server
#!/usr/bin/env bash
# A script to automate git deployment to the sever.
# credit: https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
# Start by creating a bare git repository and set the path:
# e.g: mkdir -p ~/repos/alhoqbani.com.git && cd ~/repos/alhoqbani.com.git && git init --bare
REPO_PATH=$HOME/repos/alhoqbani.com.git
# Set the path to the DcoumentRoot for the web application. e.g /var/www/html/alhoqbani.com
WORK_DIR_PATH=$HOME/alhoqbani.com
@alhoqbani
alhoqbani / bootstrap.sh
Last active March 5, 2025 10:04
Bash script to install LAMP on ubuntu
#!/usr/bin/env bash
C='\033[1;34m' # Purple Color
NC='\033[0m' # No Color
echo '##Installation: statrs' >> installation.log
export DEBIAN_FRONTEND=noninteractive
debconf-set-selections <<< "mysql-server mysql-server/root_password password root"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password root"
apt-get update -q &>> installation.log
@alhoqbani
alhoqbani / dotfiles.bs
Last active June 27, 2018 07:49
dotfiles
#!/bin/bash
echo Changing to Home directory...
cd $HOME
echo Cloning the repo..
git clone --bare https://github.com/alhoqbani/dotfiles.git .dotfiles
echo Done Cloning.
echo Checkout the files
cd .dotfiles
git config status.showuntrackedfiles no