Skip to content

Instantly share code, notes, and snippets.

View fchaussin's full-sized avatar

François CHAUSSIN fchaussin

  • François Chaussin
  • Lyon
View GitHub Profile
@fchaussin
fchaussin / objectToFormData.js
Created December 19, 2023 10:36
Convert JS object to FormData
function objectToFormData(object){
const formData = new FormData();
for (let [key, value] of Object.entries(object)) {
if (Array.isArray(value)) {
value.forEach((item) => {
formData.append(`${key}[]`, item);
});
} else if (typeof value === 'object') {
for (let [subKey, subValue] of Object.entries(value)) {
formData.append(`${key}[${subKey}]`, subValue)
@fchaussin
fchaussin / deploy.sh
Last active May 17, 2023 13:21
Manually deploy files, one by one with diff check
#!/bin/bash
# must be sudoer
[ `whoami` = root ] || { sudo "$0" "$@"; exit $?; }
# STD output colors // do not use for logs
RESTORE=$(echo -en '\033[0m')
GRAY=$(echo -en '\033[00;30m')
RED=$(echo -en '\033[00;91m')
GREEN=$(echo -en '\033[00;32m')
@fchaussin
fchaussin / ssh-copy-id.md
Last active April 14, 2021 11:36
Copy SSH Key to Remote Linux Device

Generate an SSH Key

 ssh-keygen

then

ssh-copy-id -i ~/.ssh/id_rsa.pub user@host

or from windows powershell

@fchaussin
fchaussin / tcaImageManipulation.php
Created March 30, 2021 14:23
TYPO3 ImageManipulation TCA Helper
<?php
namespace Vendor\MyExt\UserFunc;
/**
* Class TcaImageManipulation
* Image manipulation helper for TCA config
* @package Smile\MqbBase\UserFunc
*/
class TcaImageManipulation
@fchaussin
fchaussin / php_packages_sury.md
Last active March 26, 2021 09:42
Failed to fetch packages.sury.org/php

$ apt update

=> error

$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

$ sudo apt-key add /etc/apt/trusted.gpg.d/php.gpg

@fchaussin
fchaussin / apache_umask.md
Created March 18, 2021 08:35
set UMASK for Apache www-data

To be sure that the umask setting takes effect please use a simple test and do not use any other web application for this. It might be the case that these application change the rights independently from the umask setting of Apache.

Simple test PHP script:

<?php
if ($fp = fopen(time() . '.txt', 'w')) {
  fwrite($fp, 'This is a simple test.');
  fclose($fp);
  echo "done";

} else {

@fchaussin
fchaussin / gist:449d878607f28746d8e8485e74a5dbd0
Last active February 24, 2022 10:47
Debug SQL Queries in TYPO3 Repository (Extbase)
function debug($query){
$doctrineObj = $this->objectManager
->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class)
->convertQueryToDoctrineQueryBuilder($query);
$doctrineSql = $doctrineObj->getSQL();
$params = $doctrineObj->getParameters();
$search = $replace = [];
foreach ($params as $k => $v) {
$search[] = ':' . $k;
$replace[] = '\'' . $v . '\'';
@fchaussin
fchaussin / flexform_upgrade_62-76.md
Created June 16, 2020 07:33
Typo3 Upgrade 6.2 => 7.6 Flexforms

WIZARDS

browse_links.php

<script>browse_links.php?mode=wizard&act=file</script>

//becomes

@fchaussin
fchaussin / tca_upgrade_62-76.md
Last active June 16, 2020 09:49
TYPO3 TCA upgrades 6.2 => 7.6

WIZARDS

browse_links.php

'script' => 'browse_links.php?mode=wizard&act=file' ,

// becomes

@fchaussin
fchaussin / SSH files mount on windows10
Created May 27, 2020 13:47
Some utils to access ssh content in windows explorer
Install the latest version of WinFsp. https://github.com/billziss-gh/winfsp/releases/tag/v1.2POST1
Install the latest version of SSHFS-Win. Choose the x64 or x86 installer according to your computer’s architecture. https://github.com/billziss-gh/sshfs-win/releases/latest
Map Windows Drive using this URL: \\sshfs\username@machine_ip\..\..