Skip to content

Instantly share code, notes, and snippets.

@kraftb
kraftb / generate-keypair.sh
Created April 1, 2014 16:49
Generate public/private keypair and output to stdout
#!/bin/bash
BITS=2048
# In one line:
# rm -f temp.key && ssh-keygen -t rsa -b 2048 -f temp.key -N "" -q && ssh-keygen -e -f temp.key -m PKCS8 | tr "\n" " " && echo && cat temp.key | tr "\n" " " && echo
# In multiple lines:
rm -f temp.key
ssh-keygen -t rsa -b $BITS -f temp.key -N "" -q
@kraftb
kraftb / I2C_Adapter.ino
Created May 19, 2015 15:31
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
@kraftb
kraftb / README.md
Last active October 19, 2022 14:25
Completely clear the cache of a TYPO3 instance (filesystem, database)

Script for clearing all TYPO3 caches

This script aims to clear all (yes. really all) caches being used by TYPO3. So the file caches in typo3temp and typo3conf/autoload, next the database caches in tables cf_* and eventual realurl caches. And finally any PHP caches like those from APC, xcache, or other PHP accelerators/compilers.

Simply install the script at some executable location on your webserver

@kraftb
kraftb / rewrite-staticfilecache.conf
Created November 20, 2013 20:36
TYPO3 apache htaccess supporting realurl and nc_staticfilecache
######################################################################
# Copyright notice
#
# (c) 2013 webconsulting business services gmbh (office@webconsulting.at)
# All rights reserved
#
# Based on work of various TYPO3 authors.
#
# This script is part of the TYPO3 project. The TYPO3 project is
@kraftb
kraftb / gist:7246693
Created October 31, 2013 09:19
HOWTO: Use Fluid templates sharing a layout but use different content areas
TITLE: Classical TYPO3 advanced fluid templating
TAGS: TYPO3 FLUIDTEMPLATE templating cObject
template-start.html and template-page.html should get referenced from within the FLUIDTEMPLATE content object.
start.html and page.html are the files supplied by your designer.
It goes to and fro from template-start.html to start.html
Probably Neos is called "N"eos because of this fact.
-------------- template-start.html / BEGIN --------------------
@kraftb
kraftb / gist:96e060bcf1c58f647594
Created June 17, 2014 14:48
HOWTO: Extend TYPO3/extbase Model with new fields
1. Create ext_tables.sql and add new fields as usual
2. Create Configuration/TCA/Overrides/tablename.php and extend TCA therein (before: ext_tables.php)
3. Add the following lines to your ext_localconf.php. Where the first argument of "registerImplementation" is the model class you would like to extend and the second argument is your own implementation.
$extbaseObjectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\Container\\Container');
$extbaseObjectContainer->registerImplementation('Tx_News_Domain_Model_NewsDefault', 'thinkopen_at\T3ff\Domain\Model\NewsT3ff');
4. Create your own implementation of the mode class and add the new properties + getters/setters for them
@kraftb
kraftb / rewrite-staticfilecache.conf
Created August 16, 2018 14:07
TYPO3 EXT:static_file_cache Apache Config file
######################################################################
# Copyright notice
#
# (c) 2013-2018 webconsulting business services gmbh (office@webconsulting.at)
# All rights reserved
#
# Based on work of various TYPO3 authors.
#
# This script is part of the TYPO3 project. The TYPO3 project is
@kraftb
kraftb / README.md
Last active August 22, 2017 19:59
Script for opening a mysqlshell by passing it the path to a TYPO3 instance

Script for opening a mysql shell to TYPO3

This script allows to easily open a mysql shell to the database being used by a TYPO3 instance. Simply install this script in any executable path like $HOME/bin.

Then "cd" to a TYPO3 webroot and there type (possibly using bash shell expansion):

@kraftb
kraftb / gist:8844198
Created February 6, 2014 13:33
Counting TYPO3 pages in a branch
1. Create a table which helps us for this task:
CREATE TABLE ClosureTable (ancestor_id INT NOT NULL, descendant_id INT NOT NULL, path_length INT NOT NULL, PRIMARY KEY (ancestor_id, descendant_id));
2. Execute the following queries:
INSERT INTO ClosureTable (ancestor_id, descendant_id, path_length) SELECT 0,0,0;
INSERT INTO ClosureTable (ancestor_id, descendant_id, path_length) SELECT uid, uid, 0 FROM pages;
#!/usr/bin/php
<?php
// generateGettersAndSetters.php
//
// (c) 2017: kraftb@think-open.at
// Version: 1.0
$getterTemplate = '
/**