Skip to content

Instantly share code, notes, and snippets.

View kitzberger's full-sized avatar

Philipp Kitzberger kitzberger

View GitHub Profile
@kitzberger
kitzberger / fix-typo3-72779.ts
Last active November 22, 2017 13:41
TYPO3 8.7: Workaround for broken rel attribute of lightbox links
# Workaround for broken rel attribute of lightbox links in TYPO3 8.7
# See https://forge.typo3.org/issues/72779
lib.contentElement.variables.10 = LOAD_REGISTER
lib.contentElement.variables.10.content_uid = TEXT
lib.contentElement.variables.10.content_uid.field = uid
lib.contentElement.settings.media.popup.linkParams.ATagParams.dataWrap = class="{$styles.content.textmedia.linkWrap.lightboxCssClass}" rel="{$styles.content.textmedia.linkWrap.lightboxRelAttribute}[{register:content_uid}]"
lib.contentElement.stdWrap.append = RESTORE_REGISTER
@kitzberger
kitzberger / install-spotify-keybindings.sh
Last active October 26, 2020 09:02 — forked from jbonney/spotify_keybindings
Spotify - Linux key bindings
sudo apt-get install xbindkeys
echo '
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrev' >> ~/.xbindkeysrc
# When upgrading to Ubuntu 20.04 the keys didn't work at first, so Chrome had to be configured to let go of those keys: https://askubuntu.com/a/1239618/214134

ifne not available?

$ brew install moreutils

git prompt

$ brew install git bash-completion
$ vi $HOME/.bash_profile
@kitzberger
kitzberger / .bashrc-git
Last active March 2, 2019 09:46
Git stuff for .bashrc
# Pull the remote branch of the same name by default
git config --global pull.branch current
# Push the local branch to remote with the same name by default
git config --global push.branch current
# Use vim as default editor
git config --global core.editor "vim"
# Show indicator in git prompt whenever the status isn't clean
GIT_PS1_SHOWDIRTYSTATE=true
# Help based on https://gist.github.com/prwhite/8168133 thanks to @nowox and @prwhite
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([\w-]+)\s*:.*\#\#(?:@([\w-]+))?\s(.*)$$/ }; \
print "\nusage: make [target ...]\n\n"; \
for (keys %help) { \
print "$$_:\n"; \
<?php
namespace Vendor\Extension\View\Record;
class ListJson extends \TYPO3\CMS\Extbase\Mvc\View\JsonView {
private static $uriBuilder = null;
public function typolink($page, $uid = null) {
if ($page) {
if (self::$uriBuilder === null) {
// ext_tables.sql
CREATE TABLE tx_xxxxxxx_domain_model_record (
...
type int(11) unsigned DEFAULT '0',
...
);
// TCA
'type' => [
'exclude' => false,
@kitzberger
kitzberger / mysql-csv-export.sql
Created July 20, 2018 12:57
Export MySQL into CSV file
-- Wanna export a joined result?
SELECT a.id, a.name, b.name
FROM tableA a
JOIN tableB b ON a.id = b.rel_id
WHERE a.deleted=0 and b.deleted=0
ORDER BY a.name, b.nane
INTO OUTFILE '/var/lib/mysql-files/xxxx.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
@kitzberger
kitzberger / mysql-table-size.sql
Last active April 15, 2021 16:30
Optimize MySQL table sizes
-- Determine MySQL table size
SELECT
TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) 'Size in MB'
FROM information_schema.TABLES
WHERE TABLE_TYPE='BASE TABLE' AND table_schema = 'typo3'
ORDER BY data_length ASC;
-- Is MySQL configured to use separate files per table?
SELECT @@innodb_file_per_table;
-- Find out what charset and collation the DB has:
SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation'
FROM information_schema.SCHEMATA;
-- Find out what charset and collation the tables have:
SELECT T.table_name, CCSA.character_set_name, CCSA.collation_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
-- Change charset and collation of DB: