Skip to content

Instantly share code, notes, and snippets.

View stollr's full-sized avatar

Christian Stoller stollr

View GitHub Profile
@stollr
stollr / ssl-cert-generator.sh
Created April 8, 2022 13:13
SSL Certification Generator
#!/bin/sh
# References this great tutorial for creating an own CA and certificates based on it:
# https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/
#
# It is assumed that the CA cert is located at /etc/ssl/certs/root.pem and the CA key
# at /etc/ssl/private/root.key
#
if [ "$#" -ne 1 ]
then
@stollr
stollr / README.md
Last active April 8, 2022 13:07
FastCGI und PHP-FPM mit Apache 2.4 und PHP 7.x unter Debian nutzen

Apache mit FastCGI und PHP-FPM

Bei Debian sollte '''nicht''' das fastcgi sondern das proxy_fcgi Modul verwendet werden. Dafür wird die Konfiguration standardmäßig bereitgestellt.

Zunächst müssen die passenden Pakete installiert werden:

sudo apt install php-fpm

Die Konfigurationsdateien finden sich unter

@stollr
stollr / datensicherung.bat
Created September 8, 2019 18:30
Papas Datensicherungs-Script
@echo off
echo.
echo Hallo,
echo die Datensicherung wird gestartet. Datensicherung wird unter E: gesichert.
echo.
robocopy "C:\Users\Heinrich\Desktop" "E:\Datensicherung\Desktop" /MIR /NP
robocopy "C:\Firma" "E:\Datensicherung\Firma" /MIR /NP
robocopy "C:\Privat" "E:\Datensicherung\Privat" /MIR /NP
@stollr
stollr / pre-commit
Last active March 19, 2019 13:37
Check if Git username is defined locally
#!/bin/bash
# ## Description
# This pre-commit git hook makes sure that a local username is defined if there is any remote repository on github.
# This is helpful if you are working with multiple remote hosts and use different usernames. If you forget to configure
# the local username you may end up sending a wrong username to your github remote.
#
# ## Usage
# This is script is only useful if you make it available as a hook template. To achieve this, follow these steps:
#
@stollr
stollr / Symmetric Encryption and Decryption of large Files with OpenSSL.md
Last active April 12, 2019 14:51
Symmetric Encryption and Decryption of large Files with OpenSSL

PHP lacks a build-in function to encrypt and decrypt large files. openssl_encrypt can be used to encrypt strings, but loading a huge file into memory is a bad idea.

So we have to write a userland function doing that. This example uses the symmetric AES-128-CBC algorithm to encrypt smaller chunks of a large file and writes them into another file.

Encrypt Files

@stollr
stollr / AjaxAuthenticationListener.php
Last active August 29, 2015 14:02 — forked from xanf/AjaxAuthenticationListener.php
How to register an Symfony event handler to prevent JSON/AJAX requests to be redirected
<?php
namespace Acme\Bundle\MyBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
class AjaxAuthenticationListener
{