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 / install.sh
Last active September 11, 2019 09:26
Install doctl (Digital Ocean official command line utility) on Debian
# install doctl
sudo apt update
sudo apt -y install snapd
sudo snap install doctl
ln -s /snap/bin/doctl /usr/local/bin
# initiate doctl
# Generate access token herer https://cloud.digitalocean.com/account/api/tokens
doctl auth init
# list current droplets in json format
doctl compute droplet list -o json
@ahmed-abdelazim
ahmed-abdelazim / overlay_ffmpeg.sh
Last active September 10, 2019 21:56
add overlay to video
ffmpeg -i intro.mp4 -i overlay.png \
-filter_complex "[1:v]scale=520:-1,format=rgba,colorchannelmixer=aa=0.5[fg];[0][fg]overlay=1380:920:enable='between(t,0,20)'" \
-pix_fmt yuv420p -c:v libx264 -preset fast -crf 22 -c:a libmp3lame \
output.mp4
ffmpeg -i intro.mp4 -i overlay.png \
-filter_complex "[1:v]format=rgba,colorchannelmixer=aa=0.7[fg];[0][fg]overlay" \
-pix_fmt yuv420p -c:a copy \
output.mp4
@ahmed-abdelazim
ahmed-abdelazim / concat_ffmpeg.sh
Last active September 10, 2019 21:56
Concat folder Videos with ffmpeg
# Concat folder Videos with ffmpeg
ffmpeg -f concat -safe 0 -i <(for f in ./*.MP4; do echo "file '$PWD/$f'"; done) -c copy output.MP4
# Concat files in the list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
# Concat with re-encode (if faced some errors like "Non-monotonous DTS in output stream")
ffmpeg -f concat -safe 1 -i list.txt -c:v libx265 -preset ultrafast -crf 18 -c:a libmp3lame output3.mp4
# list.txt
# file 1.mp4
# file 2.mp4
@ahmed-abdelazim
ahmed-abdelazim / terraform.md
Last active July 22, 2019 13:11
Quick Terraform start

Install Terraform

wget https://releases.hashicorp.com/terraform/0.11.9/terraform_0.11.9_linux_amd64.zip
unzip terraform_0.11.9_linux_amd64.zip
export PATH="$PATH:$HOME/terraform"
cd /usr/bin
sudo ln -s $HOME/terraform
cd $HOME
source ~/.bashrc
terraform
/**
* marked - a markdown parser
* Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*/
;(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,'gm')
(/bull/g,block.bullet)
();block.list=replace(block.list)
(/bull/g,block.bullet)
('hr',/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)
@ahmed-abdelazim
ahmed-abdelazim / jq.md
Last active July 5, 2019 16:16
jq commands

Return first element of any json

jq -r '[.[] ] | .[0]' input.json

Use enviroment variable as index (integer).

jq --arg len $len -r '[.[] ] | .[$len | tonumber]."aud-cmd"' input.json

@ahmed-abdelazim
ahmed-abdelazim / node-expo.sh
Last active June 23, 2019 18:43
install nodejs + expo + npm on ubuntu
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs
sudo npm install --unsafe-perm -g expo-cli
@ahmed-abdelazim
ahmed-abdelazim / stream_to_youtube.sh
Created April 4, 2019 21:15 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@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?>
@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';