Skip to content

Instantly share code, notes, and snippets.

View peterkraume's full-sized avatar

Peter Kraume peterkraume

View GitHub Profile
@peterkraume
peterkraume / .htaccess
Last active December 18, 2015 22:59
Force SSL encryption
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI}
@peterkraume
peterkraume / .htaccess
Last active December 18, 2015 22:59
Prefix hostname with www.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.DOMAIN\.TLD$
RewriteRule ^(.*)$ http://www.DOMAIN.TLD/$1 [L,R=301]
@peterkraume
peterkraume / .htaccess
Created June 25, 2013 12:37
Basic authentication
AuthType Basic
AuthName 'Preview'
AuthUserFile /path/to/.htpasswd
require valid-user
@peterkraume
peterkraume / .htaccess
Created July 5, 2013 14:36
Restrict access to certain directories
RewriteRule ^backups/ - [F]
RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]
@peterkraume
peterkraume / tx_solr_facet.ts
Created July 12, 2013 08:56
If you want to limit the available options for a specific facet, you can do this with a queryGroup. In this example I've limited the available categories. This example is meant for TYPO3 and EXT:solr
plugin.tx_solr {
search {
faceting {
facets {
main {
label = Category
field = category_stringM
type = queryGroup
queryGroup {
@peterkraume
peterkraume / README.md
Last active December 20, 2015 05:19
How to XCLASS an old TYPO3 extension without namespace support in TYPO3 6.x

How to XCLASS an old TYPO3 extension without namespace support in TYPO3 6.x

The TYPO3 Wiki explains only how to register a XCLASS using namespace support in TYPO3 6.x

But if you want to extend an older TYPO3 extensions which doesn't use namespaces, you need to circumvent some cliffs.

  1. ext_localconf.php

    Instead of specifying the namespace you only need to indicate the class name of the class you want to XCLASS.

@peterkraume
peterkraume / Setup.ts
Last active December 20, 2015 19:49
Der noTrimWrap in 10 funktioniert nicht, in 30 schon
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10 {
value = +
noTrimWrap = || |
}
20 = TEXT
20 {
#!/bin/bash
AUTHOR="$1"
git log --author="$AUTHOR" --since="2011-01-26" --pretty="%h" > ~/foo.txt
PATCHES=`cat ~/foo.txt | wc -l`
while read PATCH; do git log --stat $PATCH^1..$PATCH | tail -n 1; done < ~/foo.txt > ~/foo2.txt
INSERTS=`cat ~/foo2.txt | awk '{s+=$4} END {print s}'`
@peterkraume
peterkraume / solr-delete.sh
Created March 30, 2015 14:30
delete documents from multiple Solr cores
#!/bin/bash
query="indexed:[2000-01-01T00:00:00Z TO 2015-03-20T00:00:00Z] AND type:tx_solr_file"
host="http://localhost:8080/solr/"
cores="
core_de \
core_en \
core_fr"
@peterkraume
peterkraume / MyDumpSplitter.sh
Created June 11, 2015 10:29
Extract single table from MySQL dump file
#!/bin/sh
# http://kedar.nitty-witty.com
#SPLIT DUMP FILE INTO INDIVIDUAL TABLE DUMPS
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue