Skip to content

Instantly share code, notes, and snippets.

@jrenggli
jrenggli / vpnsetup.sh
Last active August 29, 2015 14:22 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
@jrenggli
jrenggli / backup-all-docker-images.sh
Created December 8, 2015 17:56
Backup/Save all Docker Images to a compressed file
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do
echo $IMAGE
filename="${IMAGE//\//-}"
filename="${filename//:/-}.docker-image.gz"
docker save ${IMAGE} | pigz --stdout --best > $filename
done
@jrenggli
jrenggli / AdditionalConfiguration.php
Created December 16, 2015 21:26
pageNotFound_handling for restricted pages in TYPO3
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = 'USER_FUNCTION:EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php:user_pageNotFound->pageNotFound';
// Custom configuration for multi-language 404 page, see EXT:usermytemplate/Classes/Utility/PageNotFoundHandling.php
// ID of the page to redirect to if page was not found
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_redirectPageID'] = 123;
// ID of the page to redirect to if current page is access protected
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_loginPageID'] = 789;
@jrenggli
jrenggli / docker-top.sh
Created January 28, 2016 17:43
List all running docker containers and their resources used
docker stats `docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc) | sed -e 's/\///g'`
@jrenggli
jrenggli / local.php
Last active April 15, 2016 14:27
Use TYPO3 users (from be_users table) for authentication in Dokuwiki. This uses the authpdo plugin (https://www.dokuwiki.org/plugin:authpdo)
<?php
/**
*
*
* Currently only read only operations are implemented.
*
* Reminder:
* Configure password in configuration manager before switching authtype to `authpdo`.
* Otherwise you locking yourself out of the system.
@jrenggli
jrenggli / body-tag.ts
Created July 8, 2016 07:51
body tag definition for TYPO3. Supports backend_layouts and tx_fluidpages
page.bodyTagCObject = COA
page.bodyTagCObject {
wrap = <body|>
10 = COA
10 {
10 = TEXT
10 {
value = {$plugin.tx_fluidpages.settings.someCustomClassesDependingOnTypoScriptSettings}
insertData = 1
@jrenggli
jrenggli / nginx.conf
Created July 19, 2016 13:07
Increase timeouts in nginx
client_max_body_size 100m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
@jrenggli
jrenggli / FormatCdataViewHelper.php
Created August 11, 2016 16:26
CDATA ViewHelper for Fluid: Only wrapping if CDATA is necessary
<?php
namespace Swisscom\Finapp\ViewHelpers;
// Credits: https://git.typo3.org/Packages/TYPO3.CMS.git/blob_plain/HEAD:/typo3/sysext/fluid/Classes/ViewHelpers/Format/CdataViewHelper.php
// Extended with functionality to only wrap if CDATA is necessary.
// See $predeclaredCharacters
/* *
* This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
* *
@jrenggli
jrenggli / content-deploy-live-latest.sh
Created August 11, 2016 18:15
Content Deployment for TYPO3 CMS from production/live to latest system. Could be adjusted to several systems.
#!/bin/bash
PWD=`pwd`
SOURCEPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
WORKSPACEPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../.. && pwd )"
TARGET_HOST=latest.example.org
TARGET_PORT=22
TARGET_USER=www-data
TARGET_PATH=/home/www-data/typo3-latest/releases/current/
@jrenggli
jrenggli / content-deploy-live-local.sh
Created November 23, 2016 09:43
Content Deployment for TYPO3 CMS from production/live to local development system. Could be adjusted to several systems.
#!/bin/bash
PWD=`pwd`
SOURCEPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
WORKSPACEPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../.. && pwd )"
TARGET_PATH=${SOURCEPATH}/
TARGET_DBNAME=t3_dev
TARGET_DBUSER=t3_dev
TARGET_DBHOST=127.0.0.1