Skip to content

Instantly share code, notes, and snippets.

@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 / __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 / 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 / AdbCommands
Created October 9, 2019 18:44 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@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 / .gitattributes
Last active September 26, 2020 15:17
git_binary_diff
*.zip diff=zip
*.tgz diff=tgz
*.tar.gz diff=tgz
*.sql.gz diff=gz
*.db diff=sqlite3
*.sqlite diff=sqlite3
*.sqlite3 diff=sqlite3
@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 / 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
*