Skip to content

Instantly share code, notes, and snippets.

View jbinfo's full-sized avatar

Lhassan Baazzi jbinfo

View GitHub Profile
@jbinfo
jbinfo / prayers_scraper.py
Created September 26, 2025 23:40
Prayer Times Scraper for Morocco - Extracts Islamic prayer times from official Ministry of Habous website (habous.gov.ma) and outputs CSV format compatible with Mawaqit App for TV. Supports multiple cities, handles Arabic text, and provides clean formatted data (Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha).
import scrapy
import csv
import re
class PrayerTimesSpider(scrapy.Spider):
name = 'prayer_times'
start_urls = [
'https://habous.gov.ma/prieres/horaire_hijri_2.php?ville=58', # Casablanca city
'https://habous.gov.ma/prieres/horaire_hijri_2.php?ville=142' # Agdz city
]
@jbinfo
jbinfo / mouseJiggler.ps
Created September 18, 2025 16:06
Stay Active – PowerShell Script to Prevent Windows Idle Lock
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class NativeMethods {
[DllImport("user32.dll")]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, UIntPtr dwExtraInfo);
}
"@
@jbinfo
jbinfo / BaseAdminCrudController.php
Created August 3, 2024 10:25
Symfony EasyAdmin customize form with events
<?php
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
class BaseAdminCrudController extends AbstractCrudController
{
public function edit(AdminContext $context)
{
$event = new BeforeCrudActionEvent($context);
$this->container->get('event_dispatcher')->dispatch($event);
@jbinfo
jbinfo / oracle_hierarchical_queries.md
Last active March 27, 2021 02:33
Oracle hierarchical queries: How to find parents of a list of child, tree

In this Gist will show you how to get parents of a list of child from an Oracle database.

Let's start with the table below:

Child Parent
1 NULL
2 1
3 2
4 3
var buttons = $('div[role=dialog]').find('button:contains(Follow)').filter(function() {
return $(this).text().toLowerCase() === 'follow';
});
$.each(buttons, function(idx, itm) {
var secondes = Math.floor((Math.random() * 10) + 3);
setTimeout(function() {
$(itm).trigger('click');
}, duration = secondes * 1000);
@jbinfo
jbinfo / unique_lines_between_two_files
Last active January 30, 2020 19:34
Find unique lines between two files - Ubuntu
fgrep -vf /path/to/file1 /path/to/file2
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 21 columns, instead of 7 in line 3.
id,username,fullname,emails,fbPage,externalUrl,biography,followedBy,follows,isPrivate,isVerified,isBusinessAccount,businessCategory,businessEmail,businessPhone,businessAddressStreet,businessAddressZipcode,businessAddressCity,businessAddressRegion,businessAddressCountryCode,hashtags
5734709815,tasteititalian,Taste IT,,,https://m.facebook.com/TasteItitaliantakeaway/,"‼️The first independent Italian Gelateria in Greater Manchester ‼️
Stonebaked pizza 🍕 artisan gelato 🍦 baked pasta 🍝 tasty arancini.",430,146,0,0,1,Restaurants,[email protected],441616980410,69 BLACKFRIARS ROAD,M3 7DB,City of Salford,,GB,pizzauk
3667203339,mobipizzeria,🇮🇹Mobile Wood Fired Pizza🇬🇧,,,https://www.facebook.com/mobipizzeria/,"Mobile pop-up wood fired pizza UK-wide.
We cater for weddings, corporate events, private parties, birthdays, festivals, concerts, fetes, and many more",7486,3492,0,0,1,Restaurants,[email protected],443300100270,,SG191RB,St Neots,,GB,pizzauk
2986836082,zialuciapizza,Zia Lucia,,,http://www.zialucia.com/,
@jbinfo
jbinfo / sqlite_full_text_search_example.sql
Last active August 31, 2024 19:45
SQlite full text search example, link to the article:
-- Table that store hotels reviews
CREATE TABLE hotels_reviews (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
review TEXT NOT NULL
);
-- As SQLite index content on a virtual table,
-- We need to create a virtual table for hotels_reviews
-- I use the last extension fts5 for full text searching https://www.sqlite.org/fts5.html
-- I use the "porter" tokenizer, check this link for definition: https://www.sqlite.org/fts3.html#tokenizer
var secondes = Math.floor((Math.random() * 10) + 3);
var duration = secondes;
$('#activity-popup-dialog-body').find('.not-following').find('button.follow-button').each(function() {
var _this = this;
setTimeout(function() {
$(_this).trigger('click');
}, duration * 1000);
duration += secondes;
.mar-left-5 {
margin-left: 5px;
}
.mar-left-10 {
margin-left: 10px;
}
.mar-left-15 {
margin-left: 15px;