Skip to content

Instantly share code, notes, and snippets.

@Radon8472
Radon8472 / copy_database.sh
Created July 12, 2018 08:33
usefull scripts for all-inkll servers
#!/usr/bin/env bash
#
# Script copies the whole database from one server to another on the same host
#
# on import-time occours an error 1227 '... Access denied; you need the SUPER privilege(s) ...'
# if you have views in your source db.
# the reason is an enabled the binary log on the sql server.
#
# because only the `DEFINER user@host` line is the problem, we fix id with sed-replacement
@Radon8472
Radon8472 / __delete_shopware_theme_from_DB.sql
Last active July 27, 2018 17:21
Shopware Db Manipulation
-- Queries for Shopware 5.2.1
SET @templateID = (SELECT `id` FROM `s_core_templates` WHERE
`template` = 'Theme_Directory'
-- `name` ='Themename'
LIMIT 1);
-- SELECT DISTINCT *
DELETE `s_core_templates`, `s_core_templates_config_set`, `s_core_templates_config_layout`, `s_core_templates_config_elements`, `s_core_templates_config_values`, `s_core_snippets`
@Radon8472
Radon8472 / Mailer.php
Created November 15, 2019 11:52 — forked from DavidRockin/Mailer.php
PHPMailer save emails to IMAP folder
<?php
class Mailer extends PHPMailer {
/**
* Save email to a folder (via IMAP)
*
* This function will open an IMAP stream using the email
* credentials previously specified, and will save the email
* to a specified folder. Parameter is the folder name (ie, Sent)
<?php
/**
* prints the php errorlevel for phpinfo
*
* @param int [$errorlevel]
*
* @todo add format option, or implement diffent displays for Commandline and Server (check sapi)
*/
function phpinfo_block_errorlevel($errorlevel = null)
@Radon8472
Radon8472 / GuzzleHttp6-Debug-Handler.php
Last active February 4, 2020 07:28
Example for Debug-Outputs in GuzzleHttp version 6+
<?php
/**
* @see: https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#migrating-to-middleware
* @see: http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html
**/
$handler = \GuzzleHttp\HandlerStack::create();
// watch request
$handler->push(\GuzzleHttp\Middleware::mapRequest(function (\psr\Http\Message\RequestInterface $request) {
@Radon8472
Radon8472 / composer-remove-git-dirs.json
Created February 25, 2020 10:59
Composer-Example files
{
"comments": [
"in some situations a '.git' folder is created in target-dir. Specially for custom-modul type e.g. 'pw-module'",
"this is a big problem. Sometimes even the config 'preferred-install' has no effect."
"So this scripts will remove the folders after install/update. It works, but is not the best solution, because"
"custom-package types could be installed somewhere else."
"@see: https://github.com/composer/composer/issues/7058#issuecomment-588162369"
],
@Radon8472
Radon8472 / .htaccess-env+password
Last active March 11, 2020 07:58
My collection of usefull apache config elements
#
# this file should ask for password, but only when we are on develop-domain
# on all other hosts it should allow access without requsting user data
#
# SetEnvIf Host develop.myserver.de passreq
SetEnvIf Host "^develop\.([^\.]*)\.de$" passreqprev
AuthType Basic
AuthName "Password Required"
@Radon8472
Radon8472 / functions.inc.php
Last active July 8, 2020 08:17
php helper functions (to ensure version compatibility)
<?php
/**
* Helper function to avoid problems with the switches argument order of implode since php 7.4.0
*
* @see: https://www.php.net/manual/function.implode.php
* @see: https://3v4l.org/MZRZA
*
* @param String $glue
* @param array $pieces
*
@Radon8472
Radon8472 / export-git-patches.sh
Created August 20, 2020 10:07
Export multiple patches
#
# exports multiple patches for a commit-range
# you can choose to select only commits matching a specific sub_dir
#
# usage: export-git-patches [commit_range] [sub_dir]
#
if [ $# -gt 1 ]; then
commit_range=$1
commit_path="$2"
@Radon8472
Radon8472 / nbt-gitdiff.php
Created September 13, 2020 08:00
Textconf diff for minecraft files using TheFrozenFire/PHP-NBT-Decoder-Encoder
<?php
/**
* test - gitdiff.cmd.php
*
* written : 2018-05-01 by Radon8472
* last modified: 2019-06-22 by Radon8472
*
* @requires: https://github.com/TheFrozenFire/PHP-NBT-Decoder-Encoder
*
* reads nbt or dat-file from commdline parameter or Standard-input, to use it in git-diff textconv