Skip to content

Instantly share code, notes, and snippets.

View vzool's full-sized avatar
🎯
Focusing

Abdelaziz Elrashed vzool

🎯
Focusing
View GitHub Profile
@vzool
vzool / renew-cert.sh
Last active November 30, 2016 18:17
Script to update and install Let's Encrypt Automatically using "certbot"
#!/bin/bash
certbot renew --standalone --pre-hook "systemctl stop httpd" --post-hook "systemctl start httpd"
# Cron job by command(crontab -e)
# -------------------------
# 0 */12 * * * /root/renew-cert.sh > /dev/null 2>&1
# Apache option
# -------------------------
@vzool
vzool / config
Created December 27, 2016 16:45
~/.ssh/config
Host testgithub
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_testgithub
@vzool
vzool / gist:def09c5976e48bbe9926c40a8b7f91c6
Created January 31, 2017 10:34 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@vzool
vzool / mysql_backup.sh
Created February 15, 2017 06:19
Backup MySQL Database and keep history for 8 days
#!/bin/sh
now="$(date +'%d_%m_%Y_%H_%M_%S')"
filename="db_backup_$now".gz
backupfolder="/var/www/vhosts/example.com/httpdocs/backups"
fullpathbackupfile="$backupfolder/$filename"
logfile="$backupfolder/"backup_log_"$(date +'%Y_%m')".txt
echo "mysqldump started at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
mysqldump --user=mydbuser --password=mypass --default-character-set=utf8 mydatabase | gzip > "$fullpathbackupfile"
echo "mysqldump finished at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
@vzool
vzool / Php-Encryption_Curve25519_Test.php
Last active June 2, 2018 21:17
A test that use Php-Encryption and exchange keys by Curve25519
<?php
/*
* For testing you will need the following packages:
*
* - paragonie/random_compat
*
* - defuse/php-encryption
*
* - leigh/curve25519
*/
@vzool
vzool / point-in-polygon.php
Created April 17, 2017 13:00
The point-in-polygon algorithm allows you to check if a point is inside a polygon or outside of it.
<?php
/*
Description: The point-in-polygon algorithm allows you to check if a point is
inside a polygon or outside of it.
Author: Michaël Niessen (2009)
Website: http://AssemblySys.com
If you find this script useful, you can show your
appreciation by getting Michaël a cup of coffee ;)
PayPal: michael.niessen@assemblysys.com
@vzool
vzool / distanceCalculation.php
Created April 17, 2017 13:24
Distance calculation from the latitude/longitude of 2 points
<?php
/*
Description: Distance calculation from the latitude/longitude of 2 points
Author: Rajesh Singh (2014)
Website: http://AssemblySys.com
If you find this script useful, you can show your
appreciation by getting Rajesh a cup of coffee ;)
PayPal: rajesh.singh@assemblysys.com
@vzool
vzool / yubikey-fedora-udev.md
Last active August 22, 2017 07:14 — forked from fntlnz/yubikey-fedora-udev.md
Yubikey U2F Token CentOS/RHEL/Fedora udev rules

To use a yubico U2F token on CentOS/RHEL/Fedora you need to add the specific udev file to your system to recognize them.

Get the udev rules

wget -O /etc/udev/rules.d/70-u2f.rules https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules

Reload device events

@vzool
vzool / run-docker-as-normal-user.sh
Created October 18, 2017 05:40
Run Docker as Normal User
sudo groupadd docker && sudo gpasswd -a ${USER} docker && sudo systemctl restart docker
newgrp docker
@vzool
vzool / openpgp.txt
Created October 26, 2017 07:13
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:c1cea20af6e52c60abbcee3c07c1ad8a5eb196a1]