Skip to content

Instantly share code, notes, and snippets.

View jonaseberle's full-sized avatar
I may be slow to respond

Jonas Eberle jonaseberle

I may be slow to respond
View GitHub Profile
@jonaseberle
jonaseberle / .ddev#commands#db#general_log
Created January 10, 2024 11:25
DDEV MySQL/MariaDB general_log command
#!/bin/bash
## Description: Enable and show database general_log. Disables log after exiting (via CTRL+C)
## Usage: general_log
# saner programming env: these switches turn some bugs into errors
set -o errexit -o pipefail -o noclobber -o nounset
endC="\033[0m"
greenb="\033[1;32m"
purpleb="\033[1;35m"
<?php
declare(strict_types=1);
namespace Dmind\ConfigureCookieman\Rendering;
use Dmind\ConfigureCookieman\Service\YoutubeImageService;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface;
use TYPO3\CMS\Core\Resource\Rendering\YouTubeRenderer;
@jonaseberle
jonaseberle / gitTagRelease
Last active January 31, 2024 12:53
bin/gitTagRelease: Bash script that helps tagging commits like "live-1.2.3"; asks to push the tag and run ‹ddev surf deploy ...›.
#!/bin/bash
## Description: Create and push new git release tag. Deploy via ‹ddev surf deploy ...›.
## Requirements: You use release tags of the form <releaseChannel>-<major>.<minor>.<bugfix>
# saner programming env: these switches turn some bugs into errors
set -o errexit -o pipefail -o noclobber -o nounset
usage() {
echo "Usage:"
@jonaseberle
jonaseberle / docker-compose.yaml
Last active November 24, 2021 15:59
containers in external network
# add as a/docker-compose.yaml and b/docker-compose.yaml
#
# $ docker network create ext-net
# run from 2 terminals (in directory `a`and `b`):
# $ docker-compose up
#
# Should output the same container ID/pseudo-hostname continuously
#
# tested with docker-compose 1.29.2, 2.0.1, 2.1.0, 2.1.1, 2.2.0
# switching the networks order to [ext-net, my-net] prioritizes name resolution on the common network and makes it fail
@jonaseberle
jonaseberle / logrotate.py
Created October 4, 2021 10:13
Python logrotate
#! /usr/bin/env python
import sys
import logging.handlers
try:
logfile = sys.argv[1]
except:
print("param 1: logfile")
sys.exit(1)
@jonaseberle
jonaseberle / Surf deployment config
Last active December 9, 2021 16:55
use gordalina/cachetool in typo3/surf
# composer req gordalina/cachetool
# example for using it via HTTP if php-fpm not accessible (use --fcgi[=/run/...|=127.0.0.1:9000] if you can)
$deployment
->defineTask(
'CachetoolTask',
ShellTask::class,
[
'command' => [
'export cacheToolParams="--web=SymfonyHttpClient --web-allow-insecure --web-url='
@jonaseberle
jonaseberle / additional.php_or_AdditionalConfiguration.php
Last active January 12, 2024 09:52
Parse environment variables into $TYPO3_CONF_VARS
<?php
defined('TYPO3') || die();
/**
* Sets environment variables from the shell environment of the user (e.g. used with docker --environment=), from
* webserver's virtual host config, .htaccess (SetEnv), /etc/profile, .profile, .bashrc, ...
* When a .env file and the composer package helhum/dotenv-connector is present, the values from .env are also present
* in the environment at this stage.
*/
@jonaseberle
jonaseberle / getTypo3
Last active October 11, 2018 15:23
Helps managing/upgrading several Typo3 sources for upgrading/development. Downloads the version(s) you want to the current directory. Sets up symlinks so that e.g. typo3_src-9 will point to the newest version 9.x.x, typo3_src-9.5 to the newest version 9.5.x etc.; try "./getTypo 3.8 4.7 6.2 7 8 9 current" to see it do its job; will ask for deleti…
#!/bin/bash
# @author jonas.eberle@aero.de
# Helps managing/upgrading several Typo3 sources for upgrading/development.
# Downloads the version(s) you request to the current directory.
# Sets up symlinks so that e.g. typo3_src-9 will point to the newest version 9.x.x, typo3_src-9.5 to the newest version 9.5.x etc.
# Try "./getTypo 3.8 4.7 6.2 7 8 9 current" to see it do its job.
# Will ask for deletion if it finds outdated versions.
#
# @params Call without parameters to see usage help
# @exit 127 on wrong usage, 1 on error, 3 on unexpected redirect, 0 on success