Skip to content

Instantly share code, notes, and snippets.

👨‍💻

Josef Glatz josefglatz

👨‍💻
View GitHub Profile
@josefglatz
josefglatz / PHP strtotime relative cheatsheet.md
Last active Jun 29, 2020
I use that mainly for TYPO3 extension georgringer/news Time Restriction fields and TypoScript configuration
View PHP strtotime relative cheatsheet.md

PHP strtotime relative cheatsheet

Example for ext:news timeRestrictionHigh archive Page: show only news older than 3 years relative to last day of year

To get always the 31 december 3 years ago (actual 8.7.2020, you want 31.12.2017)

-3 years 31 december

@josefglatz
josefglatz / sudoers personal Cheatsheet.txt
Last active Jun 22, 2020
codekitchen/dinghy related sudoers configuration
View sudoers personal Cheatsheet.txt
# based on https://github.com/codekitchen/dinghy/blob/master/cli/dinghy/unfs.rb#L30 https://github.com/codekitchen/dinghy/blob/master/cli/dinghy/unfs.rb#L35
Cmnd_alias DINGHY_NFS = /usr/local/bin/dinghy nfs *
%admin ALL=(root) NOPASSWD: DINGHY_NFS
View Override TYPO3 ext:mail_conf_override settings for mailhog in an specific applicationContext.php
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
// Override configuration of LocalConfiguration
$customChanges = [
'GFX' => [
'TTFdpi' => '96',
'colorspace' => 'RGB',
@josefglatz
josefglatz / Graylog 3 setup GELF UDP and TCP.sh
Created Jun 15, 2020
Setup graylog general inputs for e.g. docker containers
View Graylog 3 setup GELF UDP and TCP.sh
#!/bin/bash
IP_ADDRESS=localhost
GRAYLOG3_URL="http://${IP_ADDRESS}:9000"
GRAYLOG3_INPUT_GELF_TCP='
{
"global": "true",
"title": "Gelf TCP",
"configuration": {
View visudo-vagrant.sh
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
Cmnd_Alias VAGRANT_HOSTSUPDATER_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTSUPDATER_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /Users/jglatz/.vagrant.d/tmp/hosts.local /etc/hosts
Cmnd_Alias ADMIN_TOOLS_HTOP = /usr/local/bin/htop
# additional user specification
@josefglatz
josefglatz / TYPO3versionnumber.sh
Created Jun 1, 2020
Get TYPO3 version from TYPO3 CLI binary
View TYPO3versionnumber.sh
# show version and applicationContext
./web/bin/typo3 | head -1
# Extract version only
./bin/typo3 | head -1 | grep -P '[0-9]+(\.[0-9]+)?([^\s]+)' -o
@josefglatz
josefglatz / Makefile_Snippet_TYPO3_backend_restriction
Last active May 27, 2020
The TYPO3 backend get's an additional .htaccess linked in /typo3 to add further access restrictions (e.g. based on IP ranges) in this snippet
View Makefile_Snippet_TYPO3_backend_restriction
# a) set env var initially to false
DEVELOPMENT_ENVIRONMENT_ACTIVE = FALSE
# b) set env var to true if env var CI_PROJECT_DIR is not set at all or is empty (The name of the variable is given by GitLab CI)
ifeq ($(CI_PROJECT_DIR),)
DEVELOPMENT_ENVIRONMENT_ACTIVE = TRUE
endif
# In an local environment the value will be TRUE now. So we can use this in IF queries in our Makefile
# ...
@josefglatz
josefglatz / ErrorPages.yaml
Last active Apr 24, 2020 — forked from bmack/LocalPageErrorHandler.php
Local Error Handler for TYPO3 (works also if your TYPO3 website is behind a basic auth)
View ErrorPages.yaml
errorHandling:
-
errorCode: '404'
errorContentSource: 't3://page?uid=316'
errorHandler: PHP
errorPhpClassFQCN: B13\AnyProject\PageErrorHandler\LocalPageErrorHandler
@josefglatz
josefglatz / AdditionalConfiguration_TemplateForMailSetting.php
Last active Jan 23, 2020
TYPO3 MAIL settings for Gmail / G-Suite TLS connection
View AdditionalConfiguration_TemplateForMailSetting.php
<?php
declare(strict_types=1);
// Override configuration of LocalConfiguration
$customChanges = [
'MAIL' => [
'defaultMailFromAddress' => 'your.user@gmail.com',
'defaultMailFromName' => 'My Name',
'transport' => 'smtp',
'transport_smtp_encrypt' => 'tls',
View vhost-anonip-directly-before-logging.conf
# ...
CustomLog "|/usr/local/bin/anonip --output /var/log/apache2/www.website.com-access.log" proxy
# ...
You can’t perform that action at this time.