Skip to content

Instantly share code, notes, and snippets.


Oliver Georgi slackero

View GitHub Profile
slackero /
Created Jun 27, 2022 — forked from zilongshanren/
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 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 / fix-serialized-data.php
Created May 29, 2021
Fix all serialized data in an UTF-8 encoded text file (MySQL dump)
View fix-serialized-data.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 / resize-svg.php
Created Jun 5, 2020
Try to resize SVG in PHP
View resize-svg.php
$dom = new DOMDocument('1.0', 'utf-8');
$svg = $dom->documentElement;
if ( ! $svg->hasAttribute('viewBox') ) { // viewBox is needed to establish
// userspace coordinates
$pattern = '/^(\d*\.\d+|\d+)(px)?$/'; // positive number, px unit optional
View 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)) {
View install-parallels-tools-debian
$ su
$ umount /media/cdrom
$ mount /dev/sr0 /media/cdrom
$ cd /media/cdrom
$ ./install
slackero / install-parallels-tools-ubuntu
Created May 5, 2017
Install/Update Parallels Tools Ubuntu
View install-parallels-tools-ubuntu
sudo mount -o exec /dev/cdrom /media/cdrom
cd /media/cdrom
sudo install
slackero /
Last active Oct 6, 2017
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 / phpwcmsfixarticledate.php
Created Jul 19, 2016
Articles in phpwcms auto expired by December 31, 2010? Then use this script to fix the article kill date (and the historical bug).
View phpwcmsfixarticledate.php
Copyright notice
(c) 2002-2011 Oliver Georgi ( // 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.
slackero / oxtheme_duplicate_settings.php
Last active Jan 24, 2017
Duplicate existing OXID theme settings for another theme of your choice.
View oxtheme_duplicate_settings.php
* $Id$
* Duplicate Theme settings for another Theme
* Script is a just a quick fix for current Oxid versions (4.10.0 tested)
* and based on the script of forum member "stefan2"
slackero /
Last active Jun 15, 2016
Twitter Cards frontend render script for phpwcms
* Twitter Cards frontend render script for phpwcms
* Use it in combination with [X] social sharing checkbox to mix
* OpenGraph meta tags with Twitter Cards Markup Tags and optional
* HTML comment to define type of Twitter Card (e.g. template)
* like <!--TWITTER:summary_large_image-->
* @see Documentation of Twitter Cards