Skip to content

Instantly share code, notes, and snippets.

@jrenggli
jrenggli / gitmodules_to_sh
Created March 3, 2014 22:26
Create shell commands from gitmodules file
Search: \[submodule ".*/([^\/]*)"\]\n\tpath = (.*)\n\turl = (.*)
Replace: git submodule add $3 $2\ngit commit -m "[TASK] Add puppet module $1"
@jrenggli
jrenggli / TYPO3.xml
Created June 10, 2014 04:38
PhpStorm CodeStyle for TYPO3
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="TYPO3_jr">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@jrenggli
jrenggli / migrate-markup-redmine-jira.php
Created June 24, 2014 11:34
Adjust markup when migrating data from Redmine to JIRA
<?php
$pattern = Array(
'/<pre>(\s)*<code class="(\S*)">/i',
'/<\/code><\/pre>/i',
'/<pre>/i',
'/<\/pre>/i',
'/@(\S*)@/i',
);
@jrenggli
jrenggli / proxy.php
Last active August 29, 2015 14:03
Adjust request headers when using proxy servers (former https.php)
<?php
/*
* Detects a Request through HTTP/HTTPS Proxy and sets the coresponding server variables.
*
* usage:
* in php.ini or .htaccess
* php_value auto_prepend_file /var/www/proxy.php
*
* in pool.d for php-fpm
* php_value[auto_prepend_file] = /var/www/proxy.php
@jrenggli
jrenggli / Menu.html
Created August 18, 2014 15:47
TYPO3 Neos: hide subItems in menu when node is not active (behaviour similar to expAll = 0 in TYPO3 CMS)
{namespace neos=TYPO3\Neos\ViewHelpers}
{namespace ts=TYPO3\TypoScript\ViewHelpers}
<ul{attributes -> f:format.raw()}>
<f:render section="itemsList" arguments="{items: items}" />
</ul>
<f:section name="itemsList">
<f:for each="{items}" as="item">
<li{ts:render(path:'{item.state}.attributes') -> f:format.raw()}>
@jrenggli
jrenggli / vrpt-extractor.json
Last active August 4, 2023 09:55
Graylog2 Extractor for VRPT/Syslog format (used by ZyXEL devices)
{
"extractors": [
{
"condition_type": "none",
"condition_value": "",
"converters": [],
"cursor_strategy": "copy",
"extractor_config": {
"regex_value": "cat=\"(.*?)\""
},
@jrenggli
jrenggli / install_puppet.sh
Created January 17, 2015 20:58
Install Puppet on Ubuntu/Debian
#echo "deb http://apt.puppetlabs.com/ wheezy main dependencies" >> /etc/apt/sources.list.d/puppet.list
#echo "deb http://apt.puppetlabs.com/ precise main dependencies" >> /etc/apt/sources.list.d/puppet.list
echo "deb http://apt.puppetlabs.com/ trusty main dependencies" >> /etc/apt/sources.list.d/puppet.list
wget http://apt.puppetlabs.com/pubkey.gpg
gpg --import pubkey.gpg
gpg -a --export 4BD6EC30 | apt-key add -
rm pubkey.gpg
aptitude install -y puppet-common
@jrenggli
jrenggli / main.cf
Created January 26, 2015 16:29
mail configuration for development systems: redirect all mails to a distinct mailbox. (Prevent mails being sent to actual recipients)
# File: /etc/postfix/main.cf
...
virtual_alias_maps = regexp:/etc/postfix/virtual
...
@jrenggli
jrenggli / ResourceModificationTimeAspect.php
Last active August 29, 2015 14:16
Add timestamp to resource links in TYPO3 Flow. (Thanks to Sascha and Visay)
<?php
namespace WE\BaseBox\Aspects;
/* *
* This script belongs to the TYPO3 Flow package "WE.BaseBox". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
@jrenggli
jrenggli / flushImageVariantCache.sh
Created April 14, 2015 08:53
flush cache for ImageVariants in TYPO3 Neos / TYPO3 Flow. Delete all persistent files not managed in table typo3_flow_resource_resource. Use to regenerate all images with ImageMagick / Imagick
cd Data/Persistent/Resources
ls -1 | while read F; do
echo '-'
resourcepointer=$(echo "SELECT resourcepointer FROM typo3_flow_resource_resource WHERE resourcepointer = '${F}';" | mysql 'DBNAME' -u'DBUSER' -p'DBPASSWORD' -s)
if [ -z "${resourcepointer}" ]; then
rm ${F}
fi
done