Skip to content

Instantly share code, notes, and snippets.

View ahmed-abdelazim's full-sized avatar

Ahmed Abdeazim ahmed-abdelazim

View GitHub Profile
@ahmed-abdelazim
ahmed-abdelazim / nginx.conf
Last active July 2, 2018 13:04
Nginx configration for HLS streaming server
#user nobody;
worker_processes 1;
error_log logs/rtmp_error.log debug;
pid logs/nginx.pid;
@ahmed-abdelazim
ahmed-abdelazim / crossdomain.xml
Created July 2, 2018 13:39
control domains using NGINX HLS streaming server
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
server {
server_name test24.company.io;
index index.html;
root /home/ubuntu/project-source/company/entry;
location / {
root /home/ubuntu/project-source/company/entry;
}
@ahmed-abdelazim
ahmed-abdelazim / mysql_to_json.php
Last active September 13, 2018 12:08
PHP code to get data from MySql database and return it as JSON
<?php
$mysqli = new mysqli('localhost','user','password','myDatabaseName');
$myArray = array();
if ($result = $mysqli->query("SELECT * FROM tableName")) {
while($row = $result->fetch_array(1)) {
$myArray[] = $row;
}
@ahmed-abdelazim
ahmed-abdelazim / age_in_days.py
Last active September 19, 2018 19:34 — forked from nasturtus/age_in_days.py
Solution for Udacity python problem (calculate age between two dates in days)
# This is The best Solution I found. forked from original code writer
# Udacity's Intro to Programming Nanodegree.
# Original problem statement:
# Given your birthday and the current date, calculate your age
# in days. Compensate for leap days. Assume that the birthday
# and current date are correct dates.
# Simply put, if you were born 1 Jan 2012 and todays date is
# 2 Jan 2012 you are 1 day old.
@ahmed-abdelazim
ahmed-abdelazim / response.json
Created November 11, 2018 20:01
Sample response of IGDB api
[{"id":1838,"name":"Painkiller: Redemption","slug":"painkiller-redemption","url":"https://www.igdb.com/games/painkiller-redemption","created_at":1355576743041,"updated_at":1541854139763,"summary":"Painkiller – Redemption continues the story of Daniel and Belial as they joined forces for the first time to end the bloody conflict between heaven and hell. You will discover all new maps, fight off literally thousands of demonic fiends, and lose yourself in the intense gameplay rounded off with an absorbing heavy metalsoundtrack. \n \nThe newest addon brings the Painkiller franchise back to its roots. Breathtaking action, thousands of monsters and exotic weapons are a solid foundation for a Painkiller game. \n \nThe game also features a tactical component; while reaching your objectives in each level, you unlock Tarot Cards, which will soon prove to be very helpful. In additional to that, collecting souls of fallen enemies will temporarily transform you into a mighty demon.","collection":236,"rating":40.0,"popular
@ahmed-abdelazim
ahmed-abdelazim / Platforms.md
Created November 18, 2018 17:20
IGDB all platforms by ID
id name
3 Linux
4 Nintendo 64
5 Wii
6 PC (Microsoft Windows)
7 PlayStation
8 PlayStation 2
9 PlayStation 3
11 Xbox
@ahmed-abdelazim
ahmed-abdelazim / default.conf
Created November 23, 2018 19:15
nginx reverse proxy simple starting configuration
server {
listen 80 default_server;
server_name *.*;
client_body_timeout 5s;
client_header_timeout 5s;
location / {
proxy_set_header Host $host;
proxy_pass http://00.00.00.00/; #replace with upstream ip
}
@ahmed-abdelazim
ahmed-abdelazim / index.php
Last active January 30, 2019 20:18
Jadwal
<?php
include "simple_html_dom.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://jdwel.com/today-matches/");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$agent= 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36';
@ahmed-abdelazim
ahmed-abdelazim / wp-config.php
Last active March 26, 2019 16:56
Fix HTTPS WordPress login to the admin panel redirect loop
<?php
// add these lines on the top of the file wp-config.php
define('WP_SITEURL', 'https://aasmouha.com');
define('WP_HOME', 'https://aasmouha.com');
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if( isset($_SERVER['HTTP_CF_VISITOR']) && strpos($_SERVER['HTTP_CF_VISITOR'], 'https') )
$_SERVER['HTTPS']='on';
php?>