Skip to content

Instantly share code, notes, and snippets.

View hollodotme's full-sized avatar
🧑‍💻
On it

Holger Woltersdorf hollodotme

🧑‍💻
On it
View GitHub Profile
@hollodotme
hollodotme / convert_databases_utf8.php
Last active April 8, 2024 23:13
Converting mysql string data form latin1 to utf8 for utf8 data stored in utf8 tables via latin1 connection
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* @link : http://www.ridesidecar.com/2013/07/30/of-databases-and-character-encodings/
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common

Signing github releases

git config --global user.signingkey you@email.domain

# Now you can make a release as normal, but with a signed commit.
git tag -s v0.1 -m "the best version yet"

# The only difference here is the -s. 
# Before you upload the tag be sure to check your signature with 
@hollodotme
hollodotme / phplint.sh
Last active December 17, 2020 08:29
PHP linting shell script - suitable for usage in PHP alpine docker containers
#!/usr/bin/env sh
OPTIND=1
EXITCODE=0
# Default parallelization
PARALLELIZE=2
# Default file name pattern
FILENAME_PATTERN='*.php'
echo "PHP linting - looking for syntax errors in PHP files."
@hollodotme
hollodotme / generatorForEach.php
Created November 7, 2018 19:24
Comparison of generator with foreach and yield from
<?php declare(strict_types=1);
class Test
{
private $arr = [];
public function __construct()
{
for ( $i = 0; $i < 10000; $i++ )
{
@hollodotme
hollodotme / .travis.yml
Last active January 14, 2019 10:40
Using xdebug filter for code coverage on travis-ci
language: php
php:
- 7.1
- 7.2
branches:
only:
- master
- development
<?php declare(strict_types=1);
if (
extension_loaded( 'xdebug' )
&& version_compare( '2.6.0', phpversion( 'xdebug' ), '<=' )
)
{
/** @noinspection PhpUndefinedFunctionInspection */
/** @noinspection PhpUndefinedConstantInspection */
xdebug_set_filter(
# prepare
$ sudo apt-get install -y linux-headers-generic build-essential dkms
# get the right ISO from http://download.virtualbox.org/virtualbox/
$ wget http://download.virtualbox.org/virtualbox/5.2.8/VBoxGuestAdditions_5.2.8.iso
# create a mount folder
$ sudo mkdir /media/VBoxGuestAdditions
# mount the ISO
$ sudo mount -o loop,ro VBoxGuestAdditions_5.2.8.iso /media/VBoxGuestAdditions
# install the guest additions
@hollodotme
hollodotme / GroupedTestDox.md
Last active May 6, 2018 21:42
PHPUnit Testdox mit gruppierten Data-Sets im Markdown-Format

😊 Passed | 🤬 Error | 😡 Failure | 😠 Warning | 🧐 Risky | 😶 Incomplete | 🤫 Skipped

Test suite: Unit

  • Environment: Development
  • Base namespace: Fortuneglobe\Prometheus\Exporters\Tests

Unit\Application\Metrics\GaugeListTest

  • Can Get Metric String For Multiple Gauges (😊 1)