Skip to content

Instantly share code, notes, and snippets.

View tarekeldeeb's full-sized avatar

Tarek Eldeeb tarekeldeeb

View GitHub Profile
@tarekeldeeb
tarekeldeeb / app.js
Last active October 28, 2015 13:43
Followed: https://gist.github.com/borissondagh/29d1ed19d0df6051c56f but got chrome error: `Exception in onResRdy: TypeError: Cannot read property 'htmlRes' of undefined`
var db = null;
angular.module('starter', ['ionic', 'myapp.controllers', 'myapp.services', 'ngCordova'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
@tarekeldeeb
tarekeldeeb / bash_parallel.sh
Created August 13, 2018 12:01
Run a bash script on parallel N-defined processes
#!/bin/bash
#Write your function here, will pass arguments: $1, $2, ..
getalphabet() {
> "$1"_alphabet.txt awk 'BEGIN{FS=""} {for(i=1;i<=NF;i++){chars[$(i)]=$(i);}} END{for(c in chars){print c;} }' $1 | sort >/dev/null
}
N=8;i=0
for f in `ls ar_*`; do
((i=i%N)); ((i++==0)) && wait
@tarekeldeeb
tarekeldeeb / Portable Deep Learning Environment for Windows 64-bit.md
Last active September 20, 2018 09:02
Including tensorflow 1.10, numpy, matplotlib, jupyter and other essentials.
  1. Starting with miniconda
  2. using conda install {tensorflow,numpy,matplotlib,jupyter}
  3. conda clean -a
  4. Manual Cleaning
  5. Write a BAT to launch Jupyter with correct environment.
  6. Zipping with 7z -> 314MB

Download from https://archive.org/details/PortableDLenv

@tarekeldeeb
tarekeldeeb / fetch_throttled.js
Last active March 22, 2020 12:17
Javascript Apply thread throttle to fetch() of URL Array without any library
/*
* Adapted from: https://stackoverflow.com/questions/38385419/throttle-amount-of-promises-open-at-a-given-time
*/
/**
* Performs a list of callable fetch actions (promise factories) so that only a limited
* number of promises are pending at any given time.
*
* @param listOfCallableActions An array of callable functions, which should return promises.
* @param limit The maximum number of promises to have pending at once.
@tarekeldeeb
tarekeldeeb / removeArabicDialects.sh
Last active June 21, 2022 17:05
Bash Script to Remove Arabic Dialects from UTF-8 or Windows-1256 / iso-8859-1 Encoding
# Bash Script to Remove Arabic Dialects from UTF-8 or Windows-1256 / iso-8859-1 Encoding
# - Converts arabic commas to latin comma
# - Remove Dialect symbols
# - Remove running spaces with a single
# - Replace Alif-with-hamza with Alif
#
# Example: removeArabicDialects my_utf8.txt > clear.txt
# Install: Copy this gist into your ~/.bashrc
# Author: Tarek Eldeeb
#
#!/bin/bash
#
# Add 1-Sec silent video with filename as a label
# This ensures the thumbnail has the filename included
#
# Parameters:
# - EXT: Video files extension
# - OFFSET: X,Y offset of the label
# - FPS: Frames per second, get by ffmpeg -i <file.ext>
# - SECONDS: Extra video length with Label
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/treeflex/dist/css/treeflex.css">
<link href='https://fonts.googleapis.com/css?family=Amiri' rel='stylesheet'>
<style>
body {
padding: 2rem 2rem 1rem;
font-family: 'Amiri', Helvetica, Arial, sans-serif;
display: flex;
"""
Blog post: https://tarekeldeeb.github.io/quran-table-for-moqantereen
------------------
Problem Definition
------------------
Try to find the optimal Sura words distribution among a given number of days with the following constraints:
- Each day should have 1000+ aya (Days 6 or less)
- The difference of word counts at each day is minimal
This is basically a https://en.wikipedia.org/wiki/Multiway_number_partitioning Problem (NP-hard)
@tarekeldeeb
tarekeldeeb / Eldeebs-AutoMailer.gs
Created June 10, 2024 12:12
Eldeebs-AutoMailer.gs
/**
*
* Eldeebs AutoMailer
* tarekeldeeb@gmail.com
*
* Installation: This script should be triggered daily.
*
* Example: https://docs.google.com/spreadsheets/d/1BBAyeWDLu4pXIQ7XbbcJ-PA0gVAY_ZzB2ym7R5nYluc
*
* History: v0.1 19.9.2016: Initial Release