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 / 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 / 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!
# 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

Retrieve a Let's encrypt cert only for nginx

Example is on Ubuntu 14.04 LTS

1. stop nginx listening on port 80

$ service nginx stop

2. Install necessary libs and start letsencrypt-auto

PATTERN="*" \
for file in `ls -1 "$PATTERN"`; do \
git mv -f "$file" `echo "$file" | perl -nE 'say ucfirst'` \
done

How to read a path of an arbitrary leaf up to the root of the tree in a MySQL parent-child table with one single query

SELECT categories.name, categories.id, categories.parent_id, categories.depth
FROM (
    SELECT
                @id AS _id,
                (
                    SELECT @id := parent_id
 FROM categories
@hollodotme
hollodotme / install-percona-server-5.7.md
Last active October 25, 2017 11:52
Installing Percona Server from Percona apt repository

Installing Percona Server from Percona apt repository

Fetch the repository packages from Percona web:

wget https://repo.percona.com/apt/percona-release_0.1-3.$(lsb_release -sc)_all.deb

Install the downloaded package with dpkg. To do that, run the following commands as root or with sudo:

@hollodotme
hollodotme / HttpCode.php
Created March 6, 2016 22:55
Abstract class with all HTTP status codes as class constants
<?php
/**
* @author hollodotme
*/
/**
* Class HttpCode
*/
abstract class HttpCode
{
@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

Re-package a vagrant box after modification

  • SSH into existing box and make changes

Update software

apt-get update && apt-get dist-upgrade -y && apt-get autoremove --purge -y
  • exit and vagrant reload