Skip to content

Instantly share code, notes, and snippets.

@daif
daif / nextcloud-19.sh
Created July 1, 2020 16:10
Nextcloud 19 installer
#!/bin/bash
# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@daif
daif / GetRandomFromArray.php
Created October 4, 2020 09:33
Get random elements from array
<?php
// Get array elements from items file
$items = file('items.txt');
// Pick a random element from array
$item = array_rand($items);
// Save chosen element to chosen file
file_put_contents('items-chosen.txt', $items[$item], FILE_APPEND);
// print the chosen element
print $items[$item];
// unset the chosen element
@daif
daif / validate_saudi_id.sql
Created October 8, 2020 21:34
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)
@daif
daif / diff_db.php
Created October 27, 2020 15:03
Compare two databases schema and generate SQL scripts
<?php
#
# diff_db() function for MySQL/MariaDB
# This function compare two databases schema and generate SQL scripts
# to update the second database.
#
# 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.
@daif
daif / erpnext-installer-v13.sh
Created April 18, 2021 01:27
ERPNext v13 installer
#!/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.
#
##################################################################