Skip to content

Instantly share code, notes, and snippets.

تنزيل التفاسير والتراجم من برنامج آيات وتحويلها إلى JSON

برنامج آيات به عدد كبير من التفاسير والتراجم، والتي تأتي مع النسخة الحاسوبية بصيغة نصية في صورة ملفات قواعد بيانات SQLite3. يمكننا تنزيلها وتحويلها إلى JSON بالخطوات التالية:

  1. تنزيل نسخة وندوز من آيات الحاسوبي من https://quran.ksu.edu.sa/ayat. (نسخة وندوز تحمل بعض التصليحات التي ليست في نسختي لينكس وماك، وليست حتى في ملفي التفاسير والتراجم المنفصلين في صفحة التنزيلات.)
  2. استخراج الملف contents/contents.standard.ayt من الملف المنزّل.
  3. تغيير امتداد الملف المستخرج contents.standard.ayt من ayt إلى zip ثم فكه.
  4. تحويل جميع الملفات التي داخل المجلدين tafasir وtarajem (وهي ملفات الكتب في صورة قواعد SQLite3) إلى صيغة JSON.
@noureddin
noureddin / sqlite3_to_json.py
Created January 19, 2021 00:14
Convert SQLite3 table to JSON (using Python3)
#!/usr/bin/env python3
# I assume that the sqlite3 db file given contains one table,
# and that table has the same name as the file (w/o the extension),
# and that you only want that table.
# This is my use-case anyway; feel free to change it to suit your situation.
# License: CC0 (Public Domain)
import sqlite3
import json

آلة حاسبة بلغة كلمات

  1. ابنِ بيئة كلمات على Qt5.
  2. اقرأ شرح المثال كاملا قبل تنفيذ أي شيء: آلة حاسبة بلغة كلمات .
  3. ضع الكود التالي في ملف باسم حاسبة.كلمات (أو أي اسم من اختيارك)، وافتحه في بيئة كلمات ونفذه.

لاحظ أن الكود المرفق هو نفسه الكود الأخير (الكامل) في الشرح، مع ثلاثة تعديلات طفيفة:

  • تعديل ارجع ب: إلى ارجع. (انظر الخطوة السادسة في بناء بيئة كلمات بالأعلى.)
@noureddin
noureddin / compile-kalimat-qt5.md
Last active December 13, 2020 21:14
Compiling Kalimat IDE using Qt5 (on GNU/Linux), and Resources for Kalimat

Compiling Kalimat IDE using Qt5 (on GNU/Linux), and Resources for Kalimat

Most of the work is already done by Adham Zahran, but still, there are some needed fixes.

Here's what to do.

  1. Install Qt 5 (and preferably QtCreator too).
  2. Install libffi (sudo apt install libffi-dev on Debian/Ubuntu).
  3. Clone the repo
@noureddin
noureddin / csv2tsv.c
Created October 30, 2020 03:28
A simple, performant CSV to TSV converter.
// A simple, performant CSV to TSV converter.
// Roughly the same performance as `xsv fmt -t '\t'`
// if compiled with `-O1` or higher.
// Note: if the input doesn't end with '\n', this program will still
// work correctly but won't add a final '\n'. If it ends with '\n',
// the output will have it.
// Copyright 2020 Noureddin (github.com/noureddin).
// License: Creative Commons Zero (aka Public Domain).
@noureddin
noureddin / stopwatch.sh
Created August 24, 2020 15:34
A simple stopwatch in Bash
#!/bin/bash
replace_line() { printf "\r\e[K$1 " ${@:2}; }
wait_enter() { read -s; }
now() { echo $( date +%s.%N ); }
time_format() {
a=$( printf "%.2f " $1 )
m=$( printf "%d" $( echo $a / 60 | bc ) )
@noureddin
noureddin / embedded-guide-ar.md
Last active July 10, 2020 22:03
الطريق إلى الأنظمة المدمجة

الطريق إلى الأنظمة المدمجة

نقلا عن منشور للدكتور المهندس وليد عيسى، صاحب دورة الإلكترونيات العملية (مذكورة في آخر المنشور).

المحتوى مطابق للمنشور الأصلى وقت نسخه (عدا السطر الأول الخاص بحذف منشورات سابقة). لم أعدّل أي حرف فيه. وإنما فحسب طوّعت تنسيقه ليناسب Markdown (لغة تنسيق مستندات مستخدمة على GitHub).

@noureddin
noureddin / AnkiInstall
Last active November 26, 2020 06:08
A small script to install/update Anki for Desktop Gnu/Linux systems
#!/usr/bin/env perl
use v5.14; use warnings; use autodie; use utf8;
# Run as root to install or upgrade Anki. To upgrade, you have to have Anki
# installed using this script, otherwise, it will be downloaded and installed
# again. But that would not make you loss any data.
# It needs Perl 5.14, axel, tar, and make. tar and make are required.
# Perl 5.12 may be used instead. And axel can be replaced by your preferred
# downloader below.