Skip to content

Instantly share code, notes, and snippets.


M-Fawaz Orabi forabi

View GitHub Profile

Keybase proof

I hereby claim:

  • I am forabi on github.
  • I am forabi ( on keybase.
  • I have a public key ASDGvN6idKxnfVCTRh4nPxlJTKJUBPQkv1z4VUa44CNdkgo

To claim this, I am signing this object:

forabi / canvas.ts
Last active Dec 18, 2019
Configuring Webpack and TypeScript for relative module imports
View canvas.ts
// src/store/reducers/workspace/canvas.ts
import { handleActions } from 'utils/store';
/// ...
import java.util.*;
import javax.comm.*;
public class SimpleWrite {
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "Hello, world!\n"; // الجملة يلي بدنا نكتبها ع المنفذ
static SerialPort serialPort;
static OutputStream outputStream;
import java.util.*;
import javax.comm.*;
/* الكلاس بتعتمد واجهة Runnable مشان نقدر نشغلها بـThread لحالها>
/ SerialPortEventListener على ما يبدو جاية من حزمة javax.comm
/ بتخلينا نستمع لأي تغيرات على منفذ تسلسلي،
/ يعني لما بصير أي شي على المنفذ، فينا نعمل أي شي،
/ هي بس شغلتا تخبرنا شو صار. */
public class SimpleRead implements Runnable, SerialPortEventListener {
forabi / auto_rtl.js
Last active Apr 11, 2016
Fix text direction for RTL articles on Pocket and file previews on GitHub and GitLab
View auto_rtl.js
// ==UserScript==
// @name Auto-RTL
// @namespace
// @version 0.1
// @description Fixes layout direction (RTL/LTR) for text on various websites
// @author You
// @match*
// @match*
// @match http*://*
// @match http*://*
View Webpack 2.0.7-beta vs Rollup
❯ rollup --version
rollup version 0.25.3
❯ time rollup -c ./rollup.js
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total
❯ time webpack
Hash: ebb00bbccd954c114d3c
Version: webpack 2.0.7-beta
Time: 3623ms
forabi /
Created Aug 1, 2015
Get total page count for all PDF files in the current working directory. Requires pdfinfo
for file in *.pdf; do
f_pages=$(pdfinfo "$file" 2>/dev/null | grep Pages | cut -d ":" -f 2 | sed -e 's/^[ \t]*//')
if [[ -z $f_pages ]]; then
echo "Error in $file" && exit 1;
num_pages=$(( num_pages + $f_pages ))
echo $num_pages;
forabi / 99-arabic.conf
Created Jun 14, 2015
Substitute Linux default font family for Arabic with Helvetica World. Save as /etc/fonts/conf.d/99-arabic.conf
View 99-arabic.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration -->
<test name="lang" compare="contains">
<test name="family" compare="not_eq">
forabi /
Created Sep 26, 2014
Statistics for Node/CoffeeScript projects
function get_file_names {
find -type f |
egrep -v '/(node_modules)|(.git)/' | # Ignore node_modules and .git
egrep -v '^./(tmp|posts|dist)/' | # Ignored dirs
egrep -v '.(swp|ttf|txt|css|woff|eot|svg|png|jpe?g|sublime-.*)$' # Ignored file types
function get_loc {
forabi / primes.js
Last active Aug 29, 2015
ECMAScript 6 implementation of Sieve of Eratosthenes algorithm
View primes.js
'use strict';
function* getPrimes(n) {
let compos = [];
for (let i = 2; i <= n; i++) {
if (compos[i]) continue;
yield i;
for (let j = i * 2; j <= n; j += i) {
compos[j] = true;