Skip to content

Instantly share code, notes, and snippets.

View maaddae's full-sized avatar
🏠
Working from home

Anthony Addae maaddae

🏠
Working from home
  • Remote
  • 09:39 (UTC)
View GitHub Profile
@maaddae
maaddae / CountryCodes.json
Created August 22, 2023 08:42 — forked from anubhavshrimal/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@maaddae
maaddae / install-docker.md
Created July 27, 2022 15:07 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@maaddae
maaddae / deploy-django.md
Created June 19, 2022 09:43 — forked from rmiyazaki6499/deploy-django.md
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent
@maaddae
maaddae / get-excerpt.php
Created October 27, 2018 00:14 — forked from timneutkens/get-excerpt.php
Get excerpt of string
<?php
/**
* Small utility function to get an excerpt. Standard length is 100 characters
*
* @param $string
* @param int $start_postion
* @param int $max_length
*
* @return string
*/
@maaddae
maaddae / .gitconfig
Created October 24, 2018 10:10 — forked from johnpolacek/.gitconfig
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
dmerged = "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
st = status
@maaddae
maaddae / phonenumbers.php
Last active July 29, 2022 13:21
Simple-Ghana-Phonenumber-Regex
<?php
// Regex quick reference
/*******************************************************************************
[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
@maaddae
maaddae / receive_file.php
Created August 24, 2018 09:18
PHP receive post from curl example.
<?php
//include the file that loads the PhpSpreadsheet classes
require 'spreadsheet/vendor/autoload.php';
$secret_key = 'ddf9dcbb413630dd650a9615c921b12d1dbe3e203b8f5d4d08bef5e47cd88979';
$uploaddir = realpath('./') . '/';
$uploadfile = $uploaddir . basename($_FILES['phyle']['name']);
$filename = $_POST['prefix'].".csv";
$key = $_POST['key'];
@maaddae
maaddae / send_file.php
Created August 24, 2018 09:14
PHP post using the curl
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
ini_set('display_errors',true);
ini_set('display_startup_errors',true);
$target_url = 'http://my-other-domain/phpspreadsheet/receive.php';
$return_url = 'http://127.0.0.1/webfiles/phpspreadsheet/receive.php';
@maaddae
maaddae / validate_form.js
Created August 24, 2018 09:02
An asynchronous validation of registration form using jquery-validate plugin.
var searchVisible = 0;
var transparent = true;
var mobile_device = false;
$(document).ready(function(){
$.material.init();
/* Activate the tooltips */
//$('[rel="tooltip"]').tooltip();
@maaddae
maaddae / wordpress_backup.py
Created August 24, 2018 08:47
A simple backup python script.
#!/usr/bin/env python
"""
Title: WordPress backup script
"""
import sys,os,statvfs
import tarfile
import time
# --- Variables --- #
backup_path = '/home/eklhenam/backup'
source_directorie = '/var/www/html/my-site-name'