Skip to content

Instantly share code, notes, and snippets.

View abdalla-alothman's full-sized avatar

Abdalla Alothman abdalla-alothman

  • Kuwait
View GitHub Profile
#!python
# A quick utility to fetch the Jummal value of an Arabic string or a series of strings.
# -- Abdullah S. A. Alothman. February 19, 2020.
import re
class Jummal:
def __init__(self):
self.valueMap = dict() # A dictionary of letters and their values.
@abdalla-alothman
abdalla-alothman / weekday.py
Created August 22, 2019 11:29
Week Day Calculator
#!/usr/bin/env python3
# Find name of week day from a provided date (day/month/year)
# Abdalla S. Alothman, 2014
# For details, please see:
# https://cs.uwaterloo.ca/~alopez-o/math-faq/node73.html
# http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#Other_variations
###############################################################################
import re, math
def computeWeekDay(d, m, y):
# Map result from formula to possible days
@abdalla-alothman
abdalla-alothman / removeChar
Last active August 29, 2015 14:06
Remove a character from a C string
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//////////////////// Remove Character from String /////////////////////////////
char *removeChar(const char *check, const char remove)
{
char *p = malloc(sizeof(char) + 1);
unsigned short int f = 0;
for(unsigned short int x = 0; check[x] != '\0'; ++x)
{
@abdalla-alothman
abdalla-alothman / hanoi.py
Created March 4, 2014 09:32
Towers of Hanoi - Python
#!/usr/bin/python3
import time
cycles = int()
def hanoi(discs, mainTower, target, auxTower):
global cycles
if discs >= 1:
cycles += 1
hanoi(discs - 1, mainTower, auxTower, target)
print("[Cycle {:<3}]\tMove disc {:<5} from {:^10} to {:^10}".format(cycles, discs, mainTower, target))
@abdalla-alothman
abdalla-alothman / aridhandler.py
Last active August 29, 2015 13:56
Convert Arabic to Hindi numerals and vice versa
#!/usr/bin/python3
class ArIdNumberHandler:
def __init__(self):
self.numMap = {0: "٠",
1: "١",
2: "٢",
3: "٣",
4: "٤",
5: "٥",
@abdalla-alothman
abdalla-alothman / tupleTest.cpp
Created February 28, 2014 13:12
GPA Calculator with C++ Tuples
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
using namespace std;
int main()
{
vector<tuple<string, unsigned short, unsigned short, string, double>> v2;
@abdalla-alothman
abdalla-alothman / progbarDownloader.py
Created February 28, 2014 12:35
Simple PyQt Progress Bar Downloader
#!/usr/bin/python3
# This is downloading class which uses python 3 with PyQt4. It shows how to use the
# QT progress bar in python. The downloading takes place in the UrlDownloader class
# which inherits from QThread.
#
# To test the widget:
# 1. try copying a URL that points to a large file.
# 2. Paste the file url into the combobox's text area, but do nothing more.
# 3. Copy another URL pointing to a large file.