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 / telegram.sh
Created February 28, 2020 20:15
Install Telegram via Official package
sudo apt-get install xz-utils
wget -O- https://telegram.org/dl/desktop/linux | sudo tar xJ -C /opt/
sudo ln -s /opt/Telegram/Telegram /usr/local/bin/telegram-desktop
@ahmed-abdelazim
ahmed-abdelazim / start-stop-ec2-instances.js
Created December 2, 2019 08:38 — forked from eddmann/start-stop-ec2-instances.js
Scheduled Start/Stop of EC2 Instances using Lambda and CloudWatch Events
// Demonstration video can be found at: https://youtu.be/roAerKVfq-Y
// StopEC2Instance
const AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
const ec2 = new AWS.EC2({ region: event.instanceRegion });
ec2.stopInstances({ InstanceIds: [event.instanceId] }).promise()
<?php
class CdnWPFC{
public static function cloudflare_clear_cache($email = false, $key = false, $zoneid = false){
if(!$email && !$key && !$zoneid){
if($cdn_values = get_option("WpFastestCacheCDN")){
$std_obj = json_decode($cdn_values);
foreach ($std_obj as $key => $value) {
if($value->id == "cloudflare"){
$email = $value->cdnurl;
import time
import boto3
transcribe = boto3.client('transcribe' , region_name='us-west-2',aws_access_key_id='ACCESS_KEY_ID',aws_secret_access_key='SECRET')
transcribe.start_transcription_job(
TranscriptionJobName='RandallTest1',
Media={
'MediaFileUri': 'https://s3-us-west-2.amazonaws.com/randhunt-transcribe-demos/test.flac'
},
MediaFormat='flac',
LanguageCode='en-US',
@ahmed-abdelazim
ahmed-abdelazim / scrape.py
Created October 4, 2019 17:52
Scaraping from profiles.txt with skills
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.keys import Keys
from parsel import Selector
from time import sleep
import requests, json
import time
@ahmed-abdelazim
ahmed-abdelazim / scrape.py
Created October 3, 2019 19:23
Scaraping from profiles.txt
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.keys import Keys
from parsel import Selector
from time import sleep
import requests, json
import time
@ahmed-abdelazim
ahmed-abdelazim / service.sh
Created September 15, 2019 21:27
Create a service from bash script on Ubuntu ( for startup )
bootscript=/root/run.sh
servicename=customboot
cat > $bootscript <<EOF
#!/usr/bin/env bash
echo "$bootscript ran at $(date)!" > /tmp/it-works
EOF
chmod +x $bootscript
@ahmed-abdelazim
ahmed-abdelazim / default
Created September 11, 2019 21:15
Install Nginx - php on Ubuntu 18 and Digital Ocean php client
server {
listen 80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
@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