Skip to content

Instantly share code, notes, and snippets.

View alexandreelise's full-sized avatar
💡
Your Website. Augmented.

Mr Alexandre J-S William ELISÉ alexandreelise

💡
Your Website. Augmented.
View GitHub Profile
@alexandreelise
alexandreelise / tinyhungryfoodie.c
Last active October 7, 2023 19:37
Tiny foodie hungry script now in C too. Originally in PHP.
/**
* Tiny hungry foodie c script
*
* @package tinyhungryfoodie
* @author Mr Alexandre J-S William ELISÉ <[email protected]>
* @copyright (c) 2009 - present . Mr Alexandre J-S William ELISÉ . Tous droits réservés.
* @license MIT
* @link https://apiadept.com
*/
#include <stdio.h>
@alexandreelise
alexandreelise / tinyhungryfoodie.php
Last active October 7, 2023 19:41
Tiny hungry foodie php script
<?php
/**
* Tiny hungry foodie php script
*
* @package tinyhungryfoodie
* @author Mr Alexandre J-S William ELISÉ <[email protected]>
* @copyright (c) 2009 - present . Mr Alexandre J-S William ELISÉ . Tous droits réservés.
* @license MIT
* @link https://apiadept.com
*/
@alexandreelise
alexandreelise / force-localhost-site
Created February 21, 2021 21:13
Replace wildcard IPv4 address in your Nginx config files by 127.0.0.1 to try to prevent remote access by internet users to you local dev virtuelhosts
#!/usr/bin/env php
<?php
/**
* This php script attempts to replace wildcard IPv4 address in Nginx sites-available/*.conf files
* by the loopback address 127.0.0.1 to try to prevent access of your local dev environment by Internet
* when listening to all network interface like *:80 or *:443 does. * means listen to all available network
* interfaces and this script tries to restrict use to loopback only.
*
* NOTE: If you have multiple wildcard IPv4 address in your conf files at the moment of writing this script it
* doesn't handle yet this edge case correctly. It just replaces all the wildcard addresses rather than having just one occurence of 127.0.0.1 you will have multiple ones which can cause "address already in use" errors while restart Nginx. Please keep that in mind. You can improve this script at will. It's a first attempt. Hope it helps someone.
@alexandreelise
alexandreelise / 90-working-setup-php74-cli-xdebug-3-phpstorm.ini
Created December 29, 2020 03:59
After struggling to make it work on the fly I decided to stick to normal setup with only one mode. debug mode. #phpstorm #xdebug3 #php74 might work with php8 also.
[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.start_upon_error=yes
xdebug.trigger_value=yes
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.connect_timeout_ms=30000
xdebug.force_display_errors=0
@alexandreelise
alexandreelise / htmlhelper-select-options-with-empty-default.php
Created September 26, 2020 01:03
Code snippet for HTMLHelper select options with empty default value
<label for="demo">Demo</label>
<select id="demo" name="demo">
<?php array_unshift($this->myExampleOptionsArray, null); ?>
<?php echo HTMLHelper::_('select.options', $this->myExampleOptionsArray, 'value', 'text', $this->selectedOptionValue ?? '');?>
</select>
@alexandreelise
alexandreelise / aej.php
Last active October 8, 2024 00:32
generate random json data structure using a cryptographically secure prng
<?php
declare(strict_types=1);
// final associative array to json_encode
$output = [];
// root level array keys
$keys_0_min = 1;
$keys_0_max = 10;
$keys_0 = [];
@alexandreelise
alexandreelise / jj.sh
Last active August 8, 2020 13:38
jj is a bash script wrapper around the amazing joomlatools/console composer package. It assumes that you already created a self-signed wildcard certitificate in /opt/selfsigned/*.sites.test directory for linux users. For macOS users adapt the script to your environment.
#!/usr/bin/env bash
RELEASE='3.9'
if [[ -z "$1" ]]; then
exit 1;
fi
PROJECT_NAME="$1"
if [[ ! -z "$2" ]]; then
@alexandreelise
alexandreelise / all.php
Last active April 12, 2022 13:20
Tiny php script to show all available JFormFields in Joomla! 3
<?php
/**
* @package all
* @author Alexandre ELISÉ <[email protected]>
* @link https://alexandre-elise.fr
* @copyright (c) 2020 . Alexandre ELISÉ . Tous droits réservés.
* @license GPL-2.0-and-later GNU General Public License v2.0 or later
* Created Date : 19/07/2020
* Created Time : 16:04
*/
@alexandreelise
alexandreelise / install-php74.sh
Last active March 7, 2020 14:58
Install php7.4 on Debian based machines. But first need to add ondrej/php ppa or source list file.
#!/usr/env sh
# To add this repository please do:
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates curl \
&& ${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
&& ${SUDO} sh -c "echo \"deb https://packages.sury.org/php/$(lsb_release -si | awk '{print tolower($0)}' ) $(lsb_release -sc) main\" > /etc/apt/sources.list.d/php.list" \
@alexandreelise
alexandreelise / README.md
Last active October 25, 2024 00:12
Install gcc 9 on Ubuntu LTS 12.04,14.04,16.04 and 18.04