Skip to content

Instantly share code, notes, and snippets.

View slackero's full-sized avatar
:octocat:
Working from home

Oliver Georgi slackero

:octocat:
Working from home
  • At home in Europe
  • 22:26 (UTC +02:00)
  • X @slackero
View GitHub Profile
@slackero
slackero / RenderPageThumbnail.html
Created April 23, 2024 05:12
Typo3 bootstrap_package get the thumbnail image from the page details
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{pageThumbnails}">
<f:for each="{pageThumbnails}" as="thumbnail" iteration="iteration">
<f:if condition="{iteration.isFirst}">
<div class="container-border">
<f:comment><f:image src="{thumbnail.data.uid}" treatIdAsReference="1" class="img-fluid" /></f:comment>
<v:media.image
src="{thumbnail.data.uid}"
treatIdAsReference="1"
@slackero
slackero / google_search_maps_addon.user.js
Last active March 4, 2024 06:04 — forked from healla/google_search_maps_addon.user.js
Bring back the google maps button when searching on google
// ==UserScript==
// @name Google maps addon
// @namespace http://tampermonkey.net/
// @version 2024-02-29
// @description Bring google maps button back
// @author You
// @match https://www.google.com/*
// @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22currentColor%22%20class%3D%22bi%20bi-geo-alt-fill%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016s6-5.686%206-10A6%206%200%200%200%202%206c0%204.314%206%2010%206%2010m0-7a3%203%200%201%201%200-6%203%203%200%200%201%200%206%22%2F%3E%3C%2Fsvg%3E
// @grant none
// ==/UserScript==
@slackero
slackero / git-export-changes-between-two-commits.md
Created June 27, 2022 16:43 — forked from zilongshanren/git-export-changes-between-two-commits.md
Git command to export only changed files between two commits

Use case : Imagine we have just created a project with composer create-project awesone-project (currently V0.2). 2 weeks later, there is a new release (V0.3). How to update your project ? Since composer update only updates the project dependencies, it is not what we are looking for. Composer doesn't know about awesome-project since it's not in our composer.json.

After trying many git solutions, I've come to this :

git archive --output=changes.zip HEAD $(git diff --name-only SHA1 SHA2 --diff-filter=ACMRTUXB)

This command will check for changes between the two commits and ignore deleted files.

@slackero
slackero / fix-serialized-data.php
Created May 29, 2021 08:58
Fix all serialized data in an UTF-8 encoded text file (MySQL dump)
<?php
$file = file_get_contents('my.sql');
function _fix_serialized($matches) {
return 's:' . strlen($matches[2]) . ':"' . $matches[2] . '";';
}
$file = preg_replace_callback('/s:(\d+):"(.*?)";/', '_fix_serialized', $file);
@slackero
slackero / resize-svg.php
Created June 5, 2020 11:25
Try to resize SVG in PHP
<?php
// https://stackoverflow.com/questions/48820832/how-to-resize-svg-with-php
$dom = new DOMDocument('1.0', 'utf-8');
$dom->load('/pathe/to/my/svg.svg');
$svg = $dom->documentElement;
if ( ! $svg->hasAttribute('viewBox') ) { // viewBox is needed to establish
// userspace coordinates
$pattern = '/^(\d*\.\d+|\d+)(px)?$/'; // positive number, px unit optional
@slackero
slackero / resumable-download.php
Created May 15, 2020 13:27 — forked from kosinix/resumable-download.php
PHP - resumable download
<?php
class ResumeDownload {
private $file;
private $name;
private $boundary;
private $delay = 0;
private $size = 0;
function __construct($file, $delay = 0) {
if (! is_file($file)) {
$ su
$ umount /media/cdrom
$ mount /dev/sr0 /media/cdrom
$ cd /media/cdrom
$ ./install
@slackero
slackero / install-parallels-tools-ubuntu
Created May 5, 2017 05:02
Install/Update Parallels Tools Ubuntu
sudo mount -o exec /dev/cdrom /media/cdrom
cd /media/cdrom
sudo install
@slackero
slackero / pcdtojpeg.md
Last active October 6, 2017 11:20
Recursive batch convert Kodak Photo CD PCD to JPEG with pcdtojpeg

How to batch convert PCD to JPEG

Kodak Photo CD support has almost gone, so the best and easy way to convert all PCD images to some more handy JPEG is to use the Photo CD Decoder pcdtojpeg. More information can be found on the project web site.

The terminal command will convert every *.PCD starting at current directory and subdirectories:

find . -name '*.PCD' -exec pcdtojpeg -q 100 -r 5 {} \;
@slackero
slackero / phpwcmsfixarticledate.php
Created July 19, 2016 16:09
Articles in phpwcms auto expired by December 31, 2010? Then use this script to fix the article kill date (and the historical bug).
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2011 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.