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
  • 05:38 (UTC +01:00)
  • X @slackero
View GitHub Profile
@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 / 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 / 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 / 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 / twbs-auto-pagination.html
Last active June 29, 2018 13:41
Auto paginate DOM elements and paginate through it using twbs-pagination http://esimakin.github.io/twbs-pagination/
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
@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 / UbuntuPleskVhosts
Last active June 28, 2017 22:16
Ubuntu 14.04 with Plesk 12: move /var/www/vhosts to another location
Use "sudo command" or as root user:
===================================
In this example /var/www/vhosts is moved to /data/www/vhosts on another partition. Change all steps as your needed for your location.
1) Stop services
~# /etc/init.d/psa stopall
OR
~# /etc/rc.d/init.d/psa stopall
@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