Skip to content

Instantly share code, notes, and snippets.

View MkLHX's full-sized avatar
🤓
Focusing

Mickael Lehoux MkLHX

🤓
Focusing
View GitHub Profile
@MkLHX
MkLHX / raspi-config-commands-list.sh
Created January 8, 2020 15:54
raspi-config command list to use it in cli
/* Command strings */
#define GET_CAN_EXPAND "raspi-config nonint get_can_expand"
#define EXPAND_FS "raspi-config nonint do_expand_rootfs"
#define GET_HOSTNAME "raspi-config nonint get_hostname"
#define SET_HOSTNAME "raspi-config nonint do_hostname %s"
#define GET_BOOT_CLI "raspi-config nonint get_boot_cli"
#define GET_AUTOLOGIN "raspi-config nonint get_autologin"
#define SET_BOOT_CLI "raspi-config nonint do_boot_behaviour B1"
#define SET_BOOT_CLIA "raspi-config nonint do_boot_behaviour B2"
#define SET_BOOT_GUI "raspi-config nonint do_boot_behaviour B3"
@MkLHX
MkLHX / template.html.twig
Last active March 25, 2020 15:16
How to update specific key on existing multidimensional array in twig
{% set contents = {"one": 1,"two":2,"three":3,"four":4,"five":5} %}
{# Create the array an structure somewhere in the view #}
{% set twigArray = {} %}
{% for content in contents %}
{% set twigArray = twigArray|merge({('hashkey_'~loop.index0):{'enabled':true,'caption':'unknow','button':{'text':'unknow','href':'unknow'},'image':{'src': content.content|raw),'alt':"image-"~loop.index, 'href':"" }}}) %}
{% endfor %}
{{ dump(twigArray)}}
{# For any reason you need to update a specific key value in the exiting array in the view
call the twig extension to do that in php side #}