Skip to content

Instantly share code, notes, and snippets.

Working @ CorpoSense

Ibrahim H. bitsnaps

Working @ CorpoSense
View GitHub Profile
bitsnaps / upload_doc.groovy
Created Feb 27, 2021
Upload a file to LogicalDOC DMS using a REST post request
View upload_doc.groovy
import static
bitsnaps / index.php
Last active Jan 20, 2021
PHP-ML machine learning php library examples
View index.php
You should first install phpml library with composer:
composer require php-ai/php-ml
then create in the same directory of vendor a file (e.g. `index.php`) with this content.
bitsnaps / php_json_compression.php
Created Dec 13, 2020
PHP json string compression different examples and comparison
View php_json_compression.php
$users = file_get_contents('');
$gz = base64_encode(gzencode($users));
if (!$gz){
die('content contains non base64 alpha');
echo $gz;
bitsnaps / json_examples.groovy
Created Dec 10, 2020
Groovy json (from/to) conversions simple examples
View json_examples.groovy
// Groovy from/to Json conversion
import groovy.json.*
// Object to Json
class Version {
int id
class User {
String className = this.class.simpleName.toLowerCase()
bitsnaps /
Created Nov 24, 2020
Upgrade PostgreSQL cluster from 9.5 to 9.6
# This script allows to upgrade postgres database server (e.g. 9.5 to 9.6)
# References:
bitsnaps /
Last active Jan 16, 2021
Scraping results from Quiz And Survey Master wordpress plugin using python3
import os, csv, requests, datetime, urllib
from bs4 import BeautifulSoup
# from dateutil.parser import parse # if you want to parse datetime
# This script allows you to grab results from your wordpress website if you're using "Quiz And Survey" plugin.
wp_host = ''
wp_login = f"{wp_host}/login"
wp_admin = f"{wp_host}/wp-admin/"
wp_quiz = f"{wp_host}/wp-admin/admin.php?page=mlw_quiz_results"
bitsnaps /
Last active Nov 4, 2020
Using VolleyPlus to make a request API on Android
* VolleySingleton
* This is just a wrapper around [VolleyPlus]( library (tested with v0.1.4)
* You can update the UI without using AsyncTask neither runOnUiThread
* It comes with caching and full image caching without third party library, included options to clear cache
* It doesn't depend on any other libraries and you can send any type of request (String, JSON...)
* It works for both Java and Groovy (it should works for Kotlin as well)
* Tested on SdkVersion v19 up to v28.
bitsnaps /
Created Sep 15, 2020
Install LLVM OpenMP on Mac
# Original source:
# 1- Clone the repo (~ 1Gb)
git clone --depth 1
cd llvm-project
mkdir build && cd build
# 2- Make sure clang & clang++ are both installed (I believe xcode should be installed as well), you'll some space (~ 16Gb)
cmake ../llvm -DLLVM_ENABLE_PROJECTS=openmp -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_CXX_COMPILER=$(which clang++)
# 3- (Optional) Running tests
make check-all
bitsnaps /
Created Jul 19, 2020 — forked from eRQee/
Ubuntu 20.04 LTS Apps Server Installation Wizard
# Am I root? #
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: this script can only be executed by root.'
echo 'Try re-run the script after switched to root account by type "sudo su"'
exit 1
bitsnaps / webrtc.js
Created May 20, 2020 — forked from tauren/webrtc.js
Using RxJS for WebRTC icecandidate handling via WebSocket signaling server
View webrtc.js
// Create WebRTC peer and setup event handlers
let peer = new RTCPeerConnection(iceConfig)
// Subject for the websocket signalling server
let socketSubject = Observable.webSocket({
// deserialize each binary message received
resultSelector: e => deserialize(
// Filter for only icecandidate messages
.filter(msg => msg && msg.header && msg.header.event === 'icecandidate' && msg.body && msg.body.candidate)