Skip to content

Instantly share code, notes, and snippets.

View djoudi's full-sized avatar
🏠
Working from home

Abdelouahab Djoudi djoudi

🏠
Working from home
View GitHub Profile
@djoudi
djoudi / metabase-setup.md
Created July 23, 2024 08:41 — forked from r0lodex/metabase-setup.md
Metabase Setup

Installing and Setting Up Metabase with Postgres

This guide is written for installation of Metabase on Ubuntu 18.04. Instead of using H2 as the application database, we will be using Postgres. You can opt to use MySQL as well. Please follow the steps below:

  • Update and install Java with proper configuration
sudo apt-get update
@djoudi
djoudi / download-file.js
Created January 20, 2023 00:11 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
nano /etc/systemd/system/idempiere.service
-----------------------------------
[Unit]
Description=Description for sample script goes here
After=local-fs.target
[Service]
Run as sudo:
sudo -i
Update server:
yum update -y
aapanel install command:
yum install -y wget && wget -O install.sh http://www.aapanel.com/script/install_6.0_en.sh && bash install.sh
@djoudi
djoudi / gist:56850d078f777501886e1e79317d3561
Created January 23, 2021 21:40 — forked from mikehaertl/gist:3258427
Learn you a Haskell - In a nutshell

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
@djoudi
djoudi / mysql-backup.sh
Created October 9, 2020 13:47 — forked from daif/mysql-backup.sh
MySQL backup tool
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@djoudi
djoudi / validate_saudi_id.sql
Created October 9, 2020 13:40 — forked from daif/validate_saudi_id.sql
Validate Saudi identity card number
#
# validate_saudi_id() function for MySQL/MariaDB
# This function will validate Saudi identity card number
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# by Daif Alazmi (http://daif.net)
@djoudi
djoudi / gist:0d4d4cc7e3423f4debe0bebea8186005
Created September 23, 2020 17:49 — forked from bonyiii/gist:822123
PostgreSQL BEFORE INSERT trigger with function
# Function returns user.login, current year, the primary_key which is the id, in 5 length (Example: 00045)
string format
# http://developer.postgresql.org/pgdocs/postgres/functions-formatting.html
# to_char(5,'00000') results the same number format
CREATE OR REPLACE FUNCTION "public"."function_name" () RETURNS trigger AS
'
BEGIN
NEW.title = (SELECT login FROM users WHERE id = NEW.author) || to_char(NOW(),\'YYYY\') || lpad(NEW.id::char, 5, \'0\');
RETURN NEW;
END
@djoudi
djoudi / README.md
Created August 13, 2020 15:33 — forked from mul14/README.md
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@djoudi
djoudi / regex-arabic.md
Created July 31, 2020 14:11 — forked from Humoud/regex-arabic.md
Detecting arabic characters with regex.

Detect all Arabic Characters:

/[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufbc1]|[\ufbd3-\ufd3f]|[\ufd50-\ufd8f]|[\ufd92-\ufdc7]|[\ufe70-\ufefc]|[\uFDF0-\uFDFD]/

Summary:

  Arabic (0600—06FF, 225 characters)

  Arabic Supplement (0750—077F, 48 characters)