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
<?php declare(strict_types=1);
/**
* @author hollodotme
* This script receives a POST request from www.serverguard24.de
* and transforms it to a POST request to a slack webhook URL with JSON payload
* 1. Configure a slack webhook URL and paste it here in line 75
* 2. Put this script on a server an make it accessible via http
* 3. Add a contact at serverguard24.de and paste the URL to this script in HTTP Push URL field
* 4. Add the contact to your server guard checks
* NOTE: Script is written for PHP >= 7.1

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 

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
@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
@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-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:

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

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

# 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