#python

Syntax Highlighting and Copy Function in Hugo
Notes for Future Use

UPDATE! I decided to drop the below functions. I just use whatever applicable/available with Hugo Built-in Functions and Clipboard.js. Please refer to the JS section below. SYNTAX HIGHLIGHTING FUNCTION I tried several methods available as described in Hugo documentation for [Syntax Highlighting] function on my blog. My first attempt was the pre-processed server side approach using [1] Pygments, an external Python-based program. I installed Pygments through pip install, not realizing that Arch has it provided under its package manager called [2] pygmentize.

My Must Have Apps on Arch Linux
The Configurations,

Among the main applications run on my Arch system are:- The sound utility with ALSA, a set of built-in GNU/Linux kernel modules where it provides kernel driven sound card. Configuration for ALSA which stands for [Advanced Linux Sound Architecture] is set locally by creating [.asoundrc] file. The linked file is what I have as a configuration that enables [1] dmix; where it allows software mixing (the ability to play multiple sound files or applications at the same time through the same device) in an easy to use syntax and without the hassle of installing/understanding a new application first.

i3wm With Conky-i3bar-JSON
Desktop View. Well, not really a desktop. It's a Window Manager.

The [i3bar] located at the bottom of the desktop is filled with status (system information) piped from [conky] via JSON. Among the item shown in the i3bar is the Hijri date obtained from a python package called 'Umalqurra'. I tweaked a bit the original python codes and modified the date and year in Hijri so that it displays the date in full arabic format. Listed below are the edited files related to the ‘Umalqurra’ package:-\

idate.py

from umalqurra.hijri_date import HijriDate #create the object with Gregorian date um = HijriDate.today() #to see the day in Hijri um.day # result : 3.0 #to see the month in Hijri um.month #result is 6.0 #year um.year #1409 #day digit in Hijri/arabic um.day_name #١٥ #day in english um.day_name_en #Tuesday #month in Hijri/arabic um.month_name #year digit in Hijri/arabic um.year_name #١٤٣٧ #month in Gregorian English um.month_name_gr #January #year in Gregorian um.year_gr #1989 #month in Gregorian um.

hijri_date.py
/usr/lib/python3.*/site-packages/ummalqura/hijri_date.py

# -*- coding: utf-8 -*- ''' This is an API for Hijri Umalqurra Calendar, it was developed by khalid Al-hussayen 1436-3-15 2015-1-6. The algorithm of converting hijri to Gregorian is in hijri.py This Api will give the ability to convert Gregorian To Hijri or Hijri to Gregorian with the day and month names in Hijri and Gregorian You can query for the current day in both Hijri and Gregorian ''' __author__ = 'Khalid & Borni' __modified_and_spelling_corrected_by__ = 'Raihan' from ummalqura.

hijri.py
/usr/lib/python3.*/site-packages/ummalqura/hijri.py

import math from ummalqura.ummalqura_arrray import UmalqurraArray ''' This class is responsoble to convert from Hijri to Gregorian or from Gregorian to Hijri The algorithm was converted from java script to python by Khalid Al-hussayen in 1436-3-14 2015-1-5 The orjinal source developed by Suhail Alkowaileet the source url https://github.com/xsoh/Hijri.js/blob/master/Hijri.js ''' class Umalqurra: def gregorian_to_hijri(self, year, month, day): # This code the modified version of R.H. van Gent Code, it can be found at http://www.

Top