Skip to content

Instantly share code, notes, and snippets.

View ReemRashwan's full-sized avatar
👩‍💻

ريم ReemRashwan

👩‍💻
View GitHub Profile
# pip install PyPDF2
from PyPDF2 import PdfFileMerger
pdfs = ['file1.pdf', 'file2.pdf']
merger = PdfFileMerger()
for pdf in pdfs:
merger.append(pdf)
@ReemRashwan
ReemRashwan / ParseXLSX.java
Created April 1, 2021 07:22
Parse Excel File (.xlsx) in JCN (Java Compute Node) in IIB (IBM Integration Bus)
/*
JAR files to be added to shared-classes folder under server or integration node dir:
dom4j-1.6.1.jar
names.txt
poi-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203.jar
xmlbeans-2.3.0.jar
*/
@ReemRashwan
ReemRashwan / isMadeOfOneChar.esql
Created February 23, 2021 08:48
ESQL: check if string contains only one unique character
CREATE FUNCTION isMadeOfOneChar(IN text CHAR, IN dividerChar CHAR) RETURNS BOOLEAN
BEGIN
DECLARE index INT 1;
DECLARE textLength INT LENGTH(text);
DECLARE currentChar CHAR;
-- If empty string, return false
IF textLength = 0 THEN
RETURN FALSE;
END IF;
@ReemRashwan
ReemRashwan / splitStringByDelimiter.esql
Last active February 16, 2021 09:28
Split a string by delimiter in ESQL (extended-sql) and store splitted parts under a root XML element.
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE message CHARACTER;
-- \n in hex is 0x0a, we need to represent it as '\n'
-- and encode it as UTF-8 whose CodingCharSetId is 1208
DECLARE newlineChar CHAR CAST(CAST('X''0A''' AS BLOB) AS CHAR CCSID 1208);
SET message = InputRoot.XMLNSC.text;
@ReemRashwan
ReemRashwan / getUserGitHubRepos.js
Created August 26, 2020 20:22
Practicing promises and yargs.
// usage: node index.js getUserRepos --username userName
const fetch = require("node-fetch");
const yargs = require("yargs");
const path = require("path");
yargs.command({
command: "getUserRepos",
builder: {
username: {
@ReemRashwan
ReemRashwan / create_dirs.py
Created May 27, 2020 00:28
Deep Learning Snippets
def create_dir(dirname):
try:
os.makedirs(dirname)
print(f"Directory '{dirname}' created.")
except FileExistsError:
print(f"Directory '{dirname}' already exists.")
@ReemRashwan
ReemRashwan / DCMDataFrameIterator.py
Last active December 22, 2023 17:59
Keras Dicom Images Data Generator and Augmenter from Dataframes (Benefits from ImageDataGenerator).
import numpy as np
import pandas as pd
import pydicom
import cv2
from sklearn.model_selection import train_test_split
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from keras_preprocessing.image.dataframe_iterator import DataFrameIterator
# tested on tf 2.1